/* ============================================
   RE/MAX Δομή Real Estate Performance
   Dark Luxury Theme — v4.0
   ============================================ */

:root {
  /* Dark Luxury Palette */
  --bg-deep:        #0a0f1e;
  --bg-dark:        #0d1428;
  --bg-card:        #111827;
  --bg-card-hover:  #1a2340;
  --bg-elevated:    #1e2d4a;
  --border:         rgba(255,255,255,0.08);
  --border-gold:    rgba(201,168,76,0.35);

  /* Text */
  --text-primary:   #f0f4ff;
  --text-secondary: #8892a8;
  --text-muted:     #4a5568;

  /* Gold Accent */
  --gold:           #c9a84c;
  --gold-light:     #e8c97a;
  --gold-pale:      rgba(201,168,76,0.12);

  /* Status */
  --success:        #22c55e;
  --success-dark:   #16a34a;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --danger-dark:    #dc2626;
  --info:           #3b82f6;

  /* Primary (blue) */
  --primary:        #3b82f6;
  --primary-dark:   #1e3a5f;
  --primary-glow:   rgba(59,130,246,0.25);

  /* Sidebar */
  --sidebar-w:      240px;
  --topbar-h:       64px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      20px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep) !important;
  color: var(--text-primary) !important;
  min-height: 100vh;
  cursor: pointer; /* iOS PWA fix: enables click bubbling on document */
}

/* Ensure dark background overrides any Tailwind light-theme classes */
body.bg-gray-50,
body.bg-white,
body.bg-gray-100 {
  background: var(--bg-deep) !important;
  color: var(--text-primary) !important;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
#sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w); z-index: 50;
  background: linear-gradient(180deg, #0d1428 0%, #091020 100%);
  border-right: 1px solid var(--border);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto; overflow-x: hidden;
  box-shadow: 4px 0 30px rgba(0,0,0,0.5);
}
#sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: shimmerBar 4s ease-in-out infinite;
}
@keyframes shimmerBar {
  0%,100% { opacity: 0.4; } 50% { opacity: 1; }
}
#sidebar.collapsed { transform: translateX(-240px); }
#main-content { margin-left: var(--sidebar-w); transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1); }
#main-content.expanded { margin-left: 0; }

/* Mobile sidebar overlay */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 45; backdrop-filter: blur(4px);
}
#sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  #sidebar { transform: translateX(-240px); z-index: 50; }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }
}

/* ── Sidebar brand ── */
.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.sidebar-brand-inner {
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-wrap {
  width: 40px; height: 40px; border-radius: 10px; overflow: hidden;
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--border-gold);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  letter-spacing: 0.02em; line-height: 1.3;
}
.sidebar-subtitle {
  font-size: 10px; font-weight: 500; color: var(--gold);
  letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px;
}

/* ── Nav items ── */
.nav-section-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  padding: 16px 16px 6px; letter-spacing: 0.1em; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; margin: 2px 8px;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; position: relative;
}
.nav-item::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; background: var(--gold);
  border-radius: 0 3px 3px 0; transition: height 0.2s;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05); color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(201,168,76,0.12), rgba(201,168,76,0.04));
  color: var(--gold-light); border: 1px solid var(--border-gold);
}
.nav-item.active::before { height: 60%; }
.nav-item .icon { width: 18px; text-align: center; font-size: 13px; }

/* ── Sidebar user footer ── */
.sidebar-user {
  position: sticky; bottom: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, #0a0f1e 60%, transparent);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #0a0f1e; flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.sidebar-user-role { font-size: 10px; color: var(--text-secondary); }

/* ══════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════ */
#topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(13,20,40,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: var(--topbar-h);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.topbar-title {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.topbar-title i { color: var(--gold); }

/* ══════════════════════════════════════════
   PAGE BACKGROUND & CONTENT
══════════════════════════════════════════ */
#page-content {
  min-height: calc(100vh - var(--topbar-h));
  background: var(--bg-deep);
}

/* ── PAGE HEADER ── */
.page-header {
  padding: 24px 24px 0; display: flex; align-items: center; justify-content: space-between;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0; transition: opacity 0.25s;
}
.card:hover {
  border-color: var(--border-gold);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(201,168,76,0.1);
  transform: translateY(-1px);
}
.card:hover::before { opacity: 0.6; }

/* ── STAT CARD ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(201,168,76,0.05) 0%, transparent 60%);
  pointer-events: none;
}
.stat-card:hover { border-color: var(--border-gold); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }

/* ── KPI CARDS ── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: all 0.25s;
  position: relative; overflow: hidden;
  cursor: default;
}
.kpi-card::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: var(--kpi-color, var(--gold));
  transform: scaleX(0); transition: transform 0.3s;
  transform-origin: left;
}
.kpi-card:hover { border-color: var(--border-gold); transform: translateY(-2px); }
.kpi-card:hover::before { transform: scaleX(1); }

/* ══════════════════════════════════════════
   LEADERBOARD
══════════════════════════════════════════ */
.leaderboard-row {
  display: grid;
  grid-template-columns: 36px 1fr 80px 72px 90px 130px 22px;
  align-items: center; padding: 12px 14px;
  border-radius: var(--radius-sm); margin-bottom: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  transition: all 0.25s; cursor: pointer; gap: 6px; min-width: 0;
}
.leaderboard-row.has-gci {
  grid-template-columns: 36px 1fr 80px 72px 90px 90px 130px 22px;
}
.leaderboard-row > * { min-width: 0; overflow: hidden; }
.leaderboard-row:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-gold);
  transform: translateX(3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
/* Gold row for rank 1 */
.leaderboard-row.rank-1 {
  background: linear-gradient(90deg, rgba(201,168,76,0.1), rgba(201,168,76,0.04));
  border-color: rgba(201,168,76,0.4);
}
/* Silver row for rank 2 */
.leaderboard-row.rank-2 {
  background: linear-gradient(90deg, rgba(148,163,184,0.08), rgba(148,163,184,0.02));
  border-color: rgba(148,163,184,0.25);
}
/* Bronze row for rank 3 */
.leaderboard-row.rank-3 {
  background: linear-gradient(90deg, rgba(251,146,60,0.08), rgba(251,146,60,0.02));
  border-color: rgba(251,146,60,0.25);
}

/* Mobile leaderboard */
@media (max-width: 640px) {
  .leaderboard-row,
  .leaderboard-row.has-gci {
    grid-template-columns: 32px 1fr auto auto;
    grid-template-rows: auto auto;
    padding: 10px 12px; row-gap: 6px;
  }
  .leaderboard-row .lb-score-col { grid-column: 3; grid-row: 1; }
  .leaderboard-row .lb-conv-col  { grid-column: 4; grid-row: 1; }
  .leaderboard-row .lb-gci-col   { grid-column: 2; grid-row: 2; font-size: 11px; }
  .leaderboard-row .lb-badge-col { grid-column: 3 / span 2; grid-row: 2; justify-content: flex-end; }
  .leaderboard-row > div:last-child { display: none; } /* hide chevron on mobile */
}

/* ── RANK BADGES ── */
.rank-badge {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.rank-1 .rank-badge {
  background: linear-gradient(135deg, #c9a84c, #e8c97a);
  color: #0a0f1e; box-shadow: 0 2px 8px rgba(201,168,76,0.4);
}
.rank-2 .rank-badge {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  color: white; box-shadow: 0 2px 8px rgba(100,116,139,0.3);
}
.rank-3 .rank-badge {
  background: linear-gradient(135deg, #c2693c, #fb923c);
  color: white; box-shadow: 0 2px 8px rgba(251,146,60,0.3);
}
.rank-other .rank-badge { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* ── SCORE BARS ── */
.score-bar { height: 5px; border-radius: 4px; background: rgba(255,255,255,0.06); overflow: hidden; width: 100%; max-width: 64px; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.7s cubic-bezier(0.4,0,0.2,1); }
.score-bar-green .score-bar-fill { background: linear-gradient(90deg, var(--success-dark), var(--success)); }
.score-bar-yellow .score-bar-fill { background: linear-gradient(90deg, #d97706, var(--warning)); }
.score-bar-red .score-bar-fill { background: linear-gradient(90deg, var(--danger-dark), var(--danger)); }

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green  { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-yellow { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.badge-red    { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-blue   { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-gold   { background: rgba(201,168,76,0.12); color: var(--gold-light); border: 1px solid var(--border-gold); }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: rgba(255,255,255,0.04);
}
.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
  background: rgba(255,255,255,0.06);
}
.form-input option { background: var(--bg-card); color: var(--text-primary); }
.form-label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px; display: block; letter-spacing: 0.04em; text-transform: uppercase;
}

/* ── SELECT ── */
select.form-input {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c9a84c' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; border: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
  opacity: 0; transition: opacity 0.2s;
  border-radius: inherit;
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, #1e3a5f, #2d6a9f);
  color: white; border: 1px solid rgba(59,130,246,0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45,106,159,0.4);
}

.btn-gold {
  background: linear-gradient(135deg, #92650a, var(--gold));
  color: #0a0f1e; font-weight: 700; border: 1px solid rgba(201,168,76,0.3);
}
.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201,168,76,0.35);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-dark), var(--success));
  color: white; border: 1px solid rgba(34,197,94,0.3);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(34,197,94,0.35); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger-dark), var(--danger));
  color: white; border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(239,68,68,0.35); }

.btn-rose {
  background: linear-gradient(135deg, #be123c, #e11d48);
  color: white; border: 1px solid rgba(225,29,72,0.3);
}
.btn-rose:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(225,29,72,0.35); }

.btn-outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.12);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(201,168,76,0.06);
}

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-ghost {
  background: transparent; border: none;
  color: var(--text-secondary); padding: 6px 10px;
}
.btn-ghost:hover { color: var(--gold-light); background: rgba(255,255,255,0.04); }

/* ══════════════════════════════════════════
   TABLES
══════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: rgba(255,255,255,0.03);
  padding: 10px 14px; text-align: left;
  font-weight: 700; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.data-table tr:hover td {
  background: rgba(255,255,255,0.03);
}

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeInOverlay 0.2s ease;
}
@keyframes fadeInOverlay { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.08);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}
.modal.modal-wide {
  max-width: 900px;
}
.modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
@keyframes modalIn { from { transform: scale(0.94) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.02);
}
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: rgba(255,255,255,0.01);
}

/* ── Modal close button ── */
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ══════════════════════════════════════════
   NOTIFICATIONS
══════════════════════════════════════════ */
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: white;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: pulse 2s infinite;
  border: 2px solid var(--bg-dark);
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); } 50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); } }

.notif-panel {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
}
.notif-panel-header {
  background: rgba(255,255,255,0.02) !important;
  border-bottom: 1px solid var(--border) !important;
}
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
  color: var(--text-primary);
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item.unread {
  background: rgba(59,130,246,0.06);
  border-left: 3px solid var(--info);
}

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tab-bar {
  display: flex; gap: 3px;
  background: rgba(255,255,255,0.04);
  padding: 4px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.tab-btn {
  padding: 7px 14px; border-radius: 6px; font-size: 12px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  color: var(--text-secondary); border: none; background: transparent;
}
.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.tab-btn.active {
  background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.05));
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════ */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 360px; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
}
.toast-success { background: rgba(22,163,74,0.9); color: white; }
.toast-error   { background: rgba(220,38,38,0.9); color: white; }
.toast-info    { background: rgba(37,99,235,0.9); color: white; }
.toast-warning { background: rgba(217,119,6,0.9); color: white; }
@keyframes slideIn {
  from { transform: translateX(60px) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}

/* ══════════════════════════════════════════
   LOADING / SKELETON
══════════════════════════════════════════ */
.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: shimmer 1.8s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Loading spinner */
.loading-center {
  display: flex; align-items: center; justify-content: center;
  height: 200px; color: var(--gold);
}

/* ══════════════════════════════════════════
   WEEK GRID
══════════════════════════════════════════ */
.week-selector { display: flex; flex-wrap: wrap; gap: 6px; }
.week-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02); color: var(--text-secondary);
}
.week-btn:hover { border-color: var(--gold); color: var(--gold-light); }
.week-btn.has-data { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #60a5fa; }
.week-btn.active { background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(201,168,76,0.08)); border-color: var(--gold); color: var(--gold-light); }
.week-btn.current-week { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: #fbbf24; }

/* ── MONTHLY GRID ── */
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* ══════════════════════════════════════════
   PARTNER AVATAR
══════════════════════════════════════════ */
.partner-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  flex-shrink: 0; border: 2px solid rgba(255,255,255,0.1);
}

/* ══════════════════════════════════════════
   TREND ARROWS
══════════════════════════════════════════ */
.trend-up   { color: var(--success); font-size: 11px; }
.trend-down { color: var(--danger); font-size: 11px; }
.trend-flat { color: var(--text-muted); font-size: 11px; }

/* ══════════════════════════════════════════
   PROGRESS BARS (targets)
══════════════════════════════════════════ */
.target-progress { height: 6px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.target-progress-fill { height: 100%; border-radius: 4px; transition: width 0.7s cubic-bezier(0.4,0,0.2,1); }
.target-progress-fill.on-track { background: linear-gradient(90deg, var(--info), #60a5fa); }
.target-progress-fill.achieved { background: linear-gradient(90deg, var(--success-dark), var(--success)); }
.target-progress-fill.behind   { background: linear-gradient(90deg, #d97706, var(--warning)); }

/* ══════════════════════════════════════════
   HEATMAP
══════════════════════════════════════════ */
.heatmap-grid { display: flex; flex-wrap: wrap; gap: 2px; }
.heatmap-cell {
  width: 18px; height: 18px; border-radius: 3px;
  cursor: default; transition: transform 0.1s;
  border: 1px solid rgba(255,255,255,0.03);
}
.heatmap-cell:hover { transform: scale(1.3); z-index: 1; }

/* ══════════════════════════════════════════
   PERSONAL DASHBOARD
══════════════════════════════════════════ */
.rank-badge-large { font-size: 3rem; font-weight: 900; line-height: 1; }

/* ══════════════════════════════════════════
   MISSING ENTRY BANNER
══════════════════════════════════════════ */
.missing-banner {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-md); padding: 14px 18px;
}

/* ══════════════════════════════════════════
   CHARTS (Canvas)
══════════════════════════════════════════ */
.chart-container { position: relative; }

/* ══════════════════════════════════════════
   SECTION HEADERS (inside cards)
══════════════════════════════════════════ */
.section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.02);
}
.section-title {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.section-title i { color: var(--gold); }

/* ══════════════════════════════════════════
   DIVIDERS & UTILITIES
══════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-gold { color: var(--gold-light); }
.text-muted { color: var(--text-secondary); }
.bg-elevated { background: var(--bg-elevated); }

/* ── Glow effect utility ── */
.glow-gold { box-shadow: 0 0 20px rgba(201,168,76,0.25); }
.glow-blue { box-shadow: 0 0 20px rgba(59,130,246,0.2); }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 640px) {
  .p-6 { padding: 12px !important; }
  .page-header { padding: 12px 12px 0; }
  .tab-bar { flex-wrap: wrap; }
  .tab-btn { padding: 6px 10px; font-size: 11px; }
  .stat-card { padding: 14px; }
  .stat-card .text-2xl { font-size: 1.25rem; }
  .grid.grid-cols-2.md\\:grid-cols-3.lg\\:grid-cols-6 { grid-template-columns: repeat(2, 1fr) !important; }
  .leaderboard-row { gap: 4px; }
  .flex.flex-wrap.items-center.justify-between { flex-direction: column; align-items: flex-start; gap: 10px; }
  .grid.grid-cols-1.xl\\:grid-cols-3 { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════
   INLINE TAILWIND OVERRIDES FOR DARK THEME
   These override Tailwind classes used across JS files
══════════════════════════════════════════ */

/* Background */
.bg-white   { background: var(--bg-card) !important; }
.bg-gray-50 { background: rgba(255,255,255,0.02) !important; }
.bg-gray-100 { background: rgba(255,255,255,0.03) !important; }

/* Text */
.text-gray-800, .text-gray-700 { color: var(--text-primary) !important; }
.text-gray-600, .text-gray-500 { color: var(--text-secondary) !important; }
.text-gray-400 { color: var(--text-muted) !important; }

/* Borders */
.border-gray-100, .border-gray-200 { border-color: var(--border) !important; }
.border-b { border-color: var(--border) !important; }

/* Specific topbar components */
#topbar .text-gray-500 { color: var(--text-secondary) !important; }
#topbar .hover\\:text-gray-700:hover { color: var(--text-primary) !important; }
#topbar .hover\\:bg-gray-100:hover { background: rgba(255,255,255,0.05) !important; }

/* Notification panel override */
#notifPanel {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6) !important;
}
#notifPanel .bg-gray-50 {
  background: rgba(255,255,255,0.03) !important;
  border-color: var(--border) !important;
}
#notifPanel .text-gray-700 { color: var(--text-primary) !important; }
#notifPanel .text-gray-400 { color: var(--text-muted) !important; }

/* Page title in topbar */
#pageTitle { color: var(--text-primary) !important; }
#pageTitle i { opacity: 1; }

/* Amber/missing banner */
.bg-amber-50 { background: rgba(245,158,11,0.08) !important; }
.border-amber-200 { border-color: rgba(245,158,11,0.25) !important; }
.text-amber-800 { color: #fbbf24 !important; }
.text-amber-700 { color: #fbbf24 !important; }
.text-amber-400 { color: rgba(251,191,36,0.5) !important; }
.text-amber-500 { color: #f59e0b !important; }

/* Dashboard leaderboard card header */
.px-5.py-4.border-b.bg-gray-50 { background: rgba(255,255,255,0.02) !important; }

/* Card headers with gray backgrounds */
[class*="bg-gray"] { --tw-bg-opacity: 1; }

/* Form placeholder */
::placeholder { color: var(--text-muted); }

/* Card content text overrides */
.font-bold.text-gray-700,
.font-bold.text-gray-800 { color: var(--text-primary) !important; }
.text-sm.text-gray-500 { color: var(--text-secondary) !important; }
.text-xs.text-gray-400 { color: var(--text-muted) !important; }
.text-gray-800.text-lg { color: var(--text-primary) !important; }

/* Leaderboard header row */
.text-xs.font-semibold.text-gray-400 { color: var(--text-muted) !important; }

/* date display topbar */
.text-sm.text-gray-500.hidden { color: var(--text-secondary) !important; }
