/* =========================================================
   Flitkick CRM — Design System
   Futuristic navy / gold theme with glass surfaces + glow
   ========================================================= */

:root {
  --navy-950: #060a18;
  --navy-900: #0a1128;
  --navy-800: #0f1a3d;
  --navy-700: #16234f;
  --navy-600: #1c2c5e;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --gold: #f2c94c;
  --gold-soft: #f7dd8a;
  --electric: #4fd1ff;
  --violet: #8b7bff;
  --green: #2ecc71;
  --red: #ff6b6b;
  --amber: #ff9d3d;

  --text-hi: #f4f6fb;
  --text-mid: #aab2cc;
  --text-low: #6d7699;

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

  --shadow-glow-gold: 0 0 0 1px rgba(242, 201, 76, 0.25), 0 8px 30px rgba(242, 201, 76, 0.08);
  --shadow-glow-blue: 0 0 0 1px rgba(79, 209, 255, 0.2), 0 8px 30px rgba(79, 209, 255, 0.08);
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.35);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text-hi);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 123, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(79, 209, 255, 0.12), transparent 55%),
    linear-gradient(180deg, var(--navy-950), var(--navy-900) 40%, var(--navy-950));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 6px; letter-spacing: -0.01em; }
p { margin: 0 0 8px; color: var(--text-mid); }

::selection { background: rgba(242, 201, 76, 0.3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-600); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-700); }

/* ---------------- Layout shell ---------------- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding-top: 70px; }
}

.sidebar {
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--navy-950);
  box-shadow: var(--shadow-glow-gold);
  font-size: 15px;
}

.brand-name { font-weight: 700; font-size: 15.5px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-low); letter-spacing: 0.06em; text-transform: uppercase; }

.nav-group-label {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-low); padding: 16px 12px 6px;
}

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-mid); font-size: 14px; font-weight: 500;
  transition: all 0.15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text-hi); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(242,201,76,0.14), rgba(242,201,76,0.02));
  color: var(--gold-soft);
  box-shadow: inset 0 0 0 1px rgba(242,201,76,0.18);
}
.nav-link .ic { width: 18px; text-align: center; opacity: 0.9; }

.sidebar-footer {
  margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line);
}

.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: var(--radius-sm);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: var(--navy-950);
  flex-shrink: 0;
}
.user-chip-name { font-size: 13px; font-weight: 600; }
.user-chip-role { font-size: 11px; color: var(--text-low); text-transform: capitalize; }

.main-content { padding: 26px 30px 60px; max-width: 1400px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px; gap: 14px; flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .subtitle { font-size: 13.5px; color: var(--text-low); }
.mobile-toggle { display: none; }
@media (max-width: 900px) {
  .mobile-toggle {
    display: flex; position: fixed; top: 14px; left: 14px; z-index: 50;
    width: 40px; height: 40px; border-radius: 10px; background: var(--navy-800);
    border: 1px solid var(--line-strong); align-items: center; justify-content: center;
    color: var(--text-hi); cursor: pointer;
  }
}

/* ---------------- Cards / surfaces ---------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.card-desc { font-size: 12.5px; color: var(--text-low); margin-bottom: 16px; }

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

/* ---------------- Stat / KPI tiles ---------------- */
.stat-tile {
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat-tile::after {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(242,201,76,0.16), transparent 70%);
  pointer-events: none;
}
.stat-label { font-size: 12px; color: var(--text-low); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.stat-sub { font-size: 12.5px; color: var(--text-mid); }
.stat-sub.positive { color: var(--green); }
.stat-sub.negative { color: var(--red); }

/* ---------------- Progress bars ---------------- */
.progress-track {
  height: 10px; border-radius: 20px; background: rgba(255,255,255,0.07);
  overflow: hidden; margin-top: 10px;
}
.progress-fill {
  height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--gold), var(--amber));
  box-shadow: 0 0 12px rgba(242,201,76,0.5);
  transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}
.progress-fill.blue { background: linear-gradient(90deg, var(--electric), var(--violet)); box-shadow: 0 0 12px rgba(79,209,255,0.5); }
.progress-fill.green { background: linear-gradient(90deg, #2ecc71, #26d0a8); box-shadow: 0 0 12px rgba(46,204,113,0.4); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all 0.15s ease;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--amber)); color: var(--navy-950);
  box-shadow: var(--shadow-glow-gold);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary {
  background: rgba(255,255,255,0.06); color: var(--text-hi); border-color: var(--line-strong);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger { background: rgba(255,107,107,0.14); color: #ffb3b3; border-color: rgba(255,107,107,0.3); }
.btn-danger:hover { background: rgba(255,107,107,0.22); }
.btn-ghost { background: transparent; color: var(--text-mid); }
.btn-ghost:hover { color: var(--text-hi); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
input, select, textarea {
  width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--line-strong);
  color: var(--text-hi); padding: 11px 13px; border-radius: 10px; font-size: 14px; font-family: inherit;
  transition: all 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-low); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,201,76,0.14);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23aab2cc'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.19l3.71-3.96a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.hint { font-size: 11.5px; color: var(--text-low); margin-top: 5px; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
thead th {
  text-align: left; padding: 12px 14px; background: rgba(255,255,255,0.03);
  color: var(--text-low); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--text-hi); }
.cell-muted { color: var(--text-low); }

/* ---------------- Badges / pills ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 20px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-admin { background: rgba(139,123,255,0.14); color: #c3b8ff; border-color: rgba(139,123,255,0.3); }
.badge-bd { background: rgba(79,209,255,0.12); color: #b6ecff; border-color: rgba(79,209,255,0.28); }

/* ---------------- Auth pages ---------------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px; background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--line-strong); border-radius: 22px; padding: 34px 32px;
  box-shadow: var(--shadow-card);
}
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-title { font-size: 20px; font-weight: 800; }
.auth-sub { font-size: 13px; color: var(--text-low); }
.auth-footer { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-low); }

/* ---------------- Alerts ---------------- */
.alert { padding: 12px 15px; border-radius: 12px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: rgba(255,107,107,0.1); color: #ffb3b3; border-color: rgba(255,107,107,0.28); }
.alert-success { background: rgba(46,204,113,0.1); color: #9be8b8; border-color: rgba(46,204,113,0.28); }
.alert-info { background: rgba(79,209,255,0.1); color: #b6ecff; border-color: rgba(79,209,255,0.28); }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,7,18,0.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid var(--line-strong); border-radius: 20px; padding: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { cursor: pointer; color: var(--text-low); font-size: 20px; line-height: 1; background: none; border: none; }
.modal-close:hover { color: var(--text-hi); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------------- Misc ---------------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-low { color: var(--text-low); }
.text-mid { color: var(--text-mid); }
.text-sm { font-size: 12.5px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-low); }
.empty-state .ic { font-size: 34px; margin-bottom: 10px; opacity: 0.6; }

.toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: toast-in 0.25s ease;
  border: 1px solid var(--line-strong);
}
.toast-success { background: #17301f; color: #9be8b8; }
.toast-error { background: #351717; color: #ffb3b3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.leaderboard-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.leaderboard-row:last-child { border-bottom: none; }
.rank-badge {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; background: rgba(255,255,255,0.06); color: var(--text-mid); flex-shrink: 0;
}
.rank-badge.gold { background: linear-gradient(135deg, var(--gold), var(--amber)); color: var(--navy-950); }
.rank-badge.silver { background: linear-gradient(135deg, #d7dbe4, #9aa2b6); color: var(--navy-950); }
.rank-badge.bronze { background: linear-gradient(135deg, #d38a5a, #a85f34); color: var(--navy-950); }

.chart-box { position: relative; height: 260px; }

/* Print styles for the admin report export */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #111; }
  .print-page { padding: 0; }
}
