/* ============================================================
   VALIDA STAFF PORTAL — Global Styles
   ============================================================ */

:root {
  --bg:            #080d1a;
  --bg2:           #0d1428;
  --valida-blue:   #4070B8;
  --glass:         rgba(255,255,255,0.04);
  --glass-border:  rgba(255,255,255,0.08);
  --glass-hover:   rgba(255,255,255,0.07);
  --va:            #38bdf8;
  --vg:            #34d399;
  --os:            #a78bfa;
  --gold:          #C9A961;
  --red:           #f87171;
  --text:          #e2e8f0;
  --muted:         #94a3b8;
  --dim:           #4b5563;
  --sidebar-w:     240px;
  --nav-h:         64px;
  --radius:        12px;
  --transition:    0.18s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'SF Pro Display', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Desktop: deep navy gradient with a faint centred Valida watermark.
   Mobile (max-width 768px) swaps this layer for the brand wallpaper. */
body {
  background: linear-gradient(135deg, #060b18 0%, #0a1628 40%, #091420 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/static/brand/valida-group-logo-master.png') center center no-repeat;
  background-size: 560px auto;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ── AGENT FLOOR CANVAS ────────────────────────────────────── */
/* Strictly ambient: locked behind all content, never interactive,
   capped opacity so it can't compete with foreground text. */
#agent-floor-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.25;
}

/* ── LAYOUT ────────────────────────────────────────────────── */
.staff-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── SIDEBAR (desktop) ─────────────────────────────────────── */
.staff-sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: rgba(8,13,26,0.85);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo img {
  height: 32px;
  width: auto;
  display: block;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* Division badge rendered as a small brand lockup image */
.division-logo {
  height: 20px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--va), var(--vg));
  flex-shrink: 0;
}

.user-info .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.user-info .user-role {
  font-size: 11px;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section {
  padding: 8px 20px 4px;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--text);
  background: var(--glass);
}

.nav-link.active {
  color: var(--va);
  border-left-color: var(--va);
  background: rgba(56,189,248,0.06);
}

.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  padding: 8px 0;
  transition: color var(--transition);
}

.logout-btn:hover { color: var(--red); }

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.staff-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.staff-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8,13,26,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}

.topbar-stat span { color: var(--text); font-weight: 600; }

.staff-content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Consistent type scale: 11px labels, 13px body, 16px subheadings, 20px titles */
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── GLASS CARDS ───────────────────────────────────────────── */
.card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.02));
  pointer-events: none;
}

.stat-card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 11px;
  color: var(--muted);
}

.stat-card.va .stat-value { color: var(--va); }
.stat-card.vg .stat-value { color: var(--vg); }
.stat-card.os .stat-value { color: var(--os); }
.stat-card.gold .stat-value { color: var(--gold); }

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-bar-wrap {
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
  height: 8px;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--vg), var(--va));
  transition: width 0.8s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; }
}

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 16px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

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

tbody tr:hover td { background: rgba(255,255,255,0.02); }

.rank-1 td:first-child { color: var(--gold); font-weight: 700; }

/* ── DIVISION PILLS ─────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill.va  { background: rgba(56,189,248,0.12);  color: var(--va); }
.pill.vg  { background: rgba(52,211,153,0.12);  color: var(--vg); }
.pill.os  { background: rgba(167,139,250,0.12); color: var(--os); }
.pill.gold { background: rgba(201,169,97,0.12);  color: var(--gold); }
.pill.gray { background: rgba(255,255,255,0.06); color: var(--muted); }

.pill.green  { background: rgba(52,211,153,0.12);  color: var(--vg); }
.pill.red    { background: rgba(248,113,113,0.12); color: var(--red); }
.pill.yellow { background: rgba(251,191,36,0.12);  color: #fbbf24; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge-locked {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.2);
  color: var(--red);
}

.badge-available {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.2);
  color: var(--vg);
}

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--valida-blue);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(64,112,184,0.18);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--dim);
}

.form-select option {
  background: #1a2540;
  color: var(--text);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--valida-blue);
  color: #fff;
}

.btn-primary:hover {
  background: #4a7fd0;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--glass-hover);
  border-color: rgba(255,255,255,0.14);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #e6c77a);
  color: #000;
}

.btn-danger {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--red);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* ── ACTIVITY FEED ──────────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--va);
  flex-shrink: 0;
  margin-top: 6px;
  box-shadow: 0 0 8px var(--va);
}

.activity-text { font-size: 13px; color: var(--text); }
.activity-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── BONUS CARD ─────────────────────────────────────────────── */
.bonus-card {
  background: linear-gradient(135deg, rgba(201,169,97,0.08), rgba(201,169,97,0.02));
  border: 1px solid rgba(201,169,97,0.25);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.bonus-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(201,169,97,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.bonus-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
}

.bonus-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(201,169,97,0.7);
  margin-top: 2px;
}

/* ── BALI BANNER ─────────────────────────────────────────────── */
.bali-banner {
  background: linear-gradient(135deg, rgba(56,189,248,0.08), rgba(52,211,153,0.06));
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.bali-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(52,211,153,0.05));
}

.bali-emoji { font-size: 32px; }

.bali-text .bali-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.bali-text .bali-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── LEAD CARDS ─────────────────────────────────────────────── */
.lead-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
  transition: all var(--transition);
  cursor: pointer;
}

.lead-card:hover {
  border-color: rgba(255,255,255,0.14);
  background: var(--glass-hover);
}

.lead-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.lead-card.locked:hover {
  border-color: var(--glass-border);
  background: var(--glass);
}

.lead-company {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.lead-meta a {
  color: var(--va);
  text-decoration: none;
}

.lead-meta a:hover { text-decoration: underline; }

/* ── FILTERS ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.filter-pill:hover { color: var(--text); border-color: rgba(255,255,255,0.14); }
.filter-pill.active { background: rgba(56,189,248,0.1); border-color: var(--va); color: var(--va); }

/* ── ALERTS & TOASTS ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert.success { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.25); color: var(--vg); }
.alert.error   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.25); color: var(--red); }
.alert.info    { background: rgba(56,189,248,0.1);  border: 1px solid rgba(56,189,248,0.25);  color: var(--va); }

#toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 769px) {
  #toast-container { bottom: 20px; right: 20px; }
}

.toast {
  background: #1a2540;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  max-width: 320px;
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast.success { border-color: rgba(52,211,153,0.3); color: var(--vg); }
.toast.error   { border-color: rgba(248,113,113,0.3); color: var(--red); }
.toast.info    { border-color: rgba(56,189,248,0.3);  color: var(--va); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── INCOME TABLE ─────────────────────────────────────────────── */
.income-positive { color: var(--vg); font-weight: 600; }
.income-pending  { color: var(--gold); }
.income-paid     { color: var(--vg); }

/* ── LOGIN PAGE ───────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(10,16,35,0.92);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  padding: 40px 36px 36px;
  position: relative;
  z-index: 2;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 44px;
  width: auto;
  display: inline-block;
  object-fit: contain;
}

.login-logo .logo-sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
  display: block;
}

.btn-login {
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background: var(--valida-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-login:hover { background: #4a7fd0; }
.btn-login:disabled { opacity: 0.7; cursor: default; }

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.04em;
  position: relative;
  z-index: 1;
}

/* ── GRID HELPERS ─────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--muted); }
.text-sm  { font-size: 12px; }
.text-xs  { font-size: 11px; }
.fw-700   { font-weight: 700; }
.fw-800   { font-weight: 800; }
.w-100    { width: 100%; }

/* ── LOADING ─────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--va);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s ease infinite;
  border-radius: 4px;
}

@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── BOTTOM NAV (mobile only) ─────────────────────────────────── */
.bottom-nav {
  display: none;
}

/* ── MOBILE ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Clean dark gradient on mobile — no wallpaper to avoid division logo bleed */
  body::before {
    background: linear-gradient(160deg, #060b18 0%, #0c1a30 50%, #080f1e 100%);
    background-size: cover;
    opacity: 1;
  }

  .staff-sidebar { display: none; }

  .staff-main { margin-left: 0; padding-bottom: 72px; }

  .staff-content { padding: 16px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .filter-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter-bar::-webkit-scrollbar { display: none; }

  .topbar-right { display: none; }

  .bonus-amount { font-size: 28px; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: rgba(8,13,26,0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    z-index: 100;
    align-items: stretch;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--dim);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: color var(--transition);
    padding: 8px 4px;
  }

  .bottom-nav-item svg { width: 22px; height: 22px; }

  .bottom-nav-item.active {
    color: var(--va);
  }

  .bottom-nav-item.active svg {
    filter: drop-shadow(0 0 6px var(--va));
  }
}

/* ── LEADERBOARD HIGHLIGHT ─────────────────────────────────────── */
.lb-gold {
  background: linear-gradient(90deg, rgba(201,169,97,0.08), transparent) !important;
}

.lb-gold td:first-child { color: var(--gold); }

/* ── PULSING DOT ─────────────────────────────────────────────── */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--vg);
  animation: pulse-glow 2s ease infinite;
  display: inline-block;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(52,211,153,0); }
}

/* ── INPUT WITH ICON ─────────────────────────────────────────── */
.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.input-wrap .form-input {
  padding-left: 38px;
}

/* ── SECTION TITLE ───────────────────────────────────────────── */
.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ── DIVIDER ─────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: 20px 0;
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
  max-width: 300px;
  margin: 0 auto;
}

/* ── TICKER ──────────────────────────────────────────────────── */
.ticker-wrap {
  background: rgba(56,189,248,0.04);
  border: 1px solid rgba(56,189,248,0.1);
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.ticker-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--va);
  white-space: nowrap;
  flex-shrink: 0;
}

.ticker-content {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  animation: ticker-scroll 20s linear infinite;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── AVATAR INITIALS ─────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.lead-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 300;
}
.lead-drawer-overlay.open { display: block; }

.lead-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100vw;
  height: 100%;
  background: var(--card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.lead-drawer.open { transform: translateX(0); }

.lead-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.lead-drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.lead-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-section {
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}
.drawer-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.drawer-brief-box {
  font-size: 13px;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-timeline-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .03);
  font-size: 13px;
  color: var(--muted);
}
.drawer-timeline-item.has-data {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.quality-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, .08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.quality-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--vg);
  transition: width .4s;
}

.script-pack-placeholder {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  padding: 12px 0;
}

.btn-icon {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, color .18s;
  line-height: 1;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, .12);
  color: var(--text);
}

@media (max-width: 600px) {
  .lead-drawer { width: 100vw; }
}

/* ═══════════════════════════════════════════════════════════════════
   IPHONE / MOBILE — WORLD-CLASS UX PATCH
   Applied 2026-07-07 — Fixes all 8 mobile issues
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Prevent iOS auto-zoom on input focus (font-size must be ≥16px) ── */
@media (max-width: 767px) {
  .form-input,
  .form-select,
  .form-textarea,
  .task-input,
  .input-wrap .form-input,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="search"],
  input[type="number"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
  }
  .form-textarea,
  textarea {
    min-height: 88px;
  }
}

/* ── 2. Touch targets — all buttons/links ≥44px ── */
@media (max-width: 767px) {
  .btn,
  .btn-sm,
  .btn-icon,
  .bottom-nav-item,
  button {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation; /* kills 300ms delay & double-tap zoom */
  }
  .btn-sm { padding: 10px 14px; font-size: 13px; }
}

/* ── 3. touch-action on all interactive elements ── */
a, button, .btn, [onclick], .lead-card, .filter-pill, .bottom-nav-item {
  touch-action: manipulation;
}

/* ── 4. Kill grey tap flash on iOS ── */
* {
  -webkit-tap-highlight-color: transparent;
}

/* ── 5. Momentum scrolling everywhere ── */
.lead-list,
.lead-drawer-body,
.drawer-body,
.activity-feed,
.filter-bar,
.timeline-list,
.objection-log,
.script-pack,
.engagements,
[class*="scroll"] {
  -webkit-overflow-scrolling: touch;
}

/* ── 6. Safe-area insets — notch + home bar ── */
@media (max-width: 767px) {
  /* Bottom nav clears home indicator */
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 16px);
    height: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* Lead drawer clears both notch and home bar */
  .lead-drawer {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Main content area clears bottom nav + home bar */
  .main-content,
  .page-content,
  .staff-main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;

/* ═══════════════════════════════════════════════════════════════════
   IPHONE LAYOUT FIX — 2026-07-30
   Prevent horizontal overflow on all mobile viewports
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .staff-content, .staff-main {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Stat grid — single column on very small screens */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* AI Agent Floor iframe — constrain to viewport */
  .hq-floor-embed, iframe {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Task dock tab bar — horizontal scroll, no wrap */
  .task-dock-tabs, .dock-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* Recent activity — prevent overflow */
  .activity-feed .activity-item,
  .activity-item {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Road to bonus section */
  .bonus-section, [class*="bonus"] {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Filter pills — horizontal scroll */
  .filter-pills, .crm-client-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .filter-pills::-webkit-scrollbar,
  .crm-client-pills::-webkit-scrollbar { display: none; }
}

/* ── iPhone lead card tap fix ── */
@media (max-width: 767px) {
  .lead-card {
    /* Force iOS to recognise div as tappable */
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(255,255,255,0.08);
    user-select: none;
    -webkit-user-select: none;
  }
  /* Claim and Call buttons — bigger touch targets on mobile */
  .badge-available .btn,
  .badge-available a.btn {
    padding: 8px 14px !important;
    font-size: 12px !important;
    min-height: 40px;
    min-width: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Drawer scroll fix for iOS ── */
.lead-drawer-body,
#drawer-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Prevent the drawer overlay from capturing scroll events meant for drawer body */
.lead-drawer-overlay {
  overscroll-behavior: none;
}
