/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --bg4: #222222;
  --border: #2a2a2a;
  --border2: #333333;
  --gold: #c9a84c;
  --gold2: #e8c96a;
  --gold-dim: rgba(201,168,76,0.12);
  --gold-border: rgba(201,168,76,0.25);
  --text: #ffffff;
  --text2: #a0a0a0;
  --text3: #555555;
  --green: #22c55e;
  --green-bg: #052010;
  --green-border: #0a3a1a;
  --amber: #f59e0b;
  --amber-bg: #1a1000;
  --red: #ef4444;
  --red-bg: #1a0505;
  --blue: #60a5fa;
  --radius: 10px;
  --radius-lg: 14px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCREENS ===== */
.screen { display: none; }
.screen.active { display: block; }

/* ===== LOGIN ===== */
.modal-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.modal {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}
.modal-logo { text-align: center; margin-bottom: 1.75rem; }
.logo-icon { font-size: 40px; margin-bottom: 8px; }
.logo-title { font-size: 24px; font-weight: 700; }
.logo-sub { font-size: 13px; color: var(--text2); margin-top: 4px; }
.gold { color: var(--gold); }
.switch-link {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text2);
}
.switch-link span { color: var(--gold); cursor: pointer; }
.switch-link span:hover { text-decoration: underline; }
.invited-by {
  background: var(--green-bg);
  border: 0.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--green);
  display: none;
}

/* ===== NAV ===== */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-brand { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-username { font-size: 13px; color: var(--text2); }

/* ===== LAYOUT ===== */
.pad { padding: 0 20px 3rem; max-width: 680px; margin: 0 auto; }

/* ===== VIEW TOGGLE ===== */
.view-toggle {
  display: flex;
  margin: 1.25rem 0;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}
.view-btn {
  flex: 1;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  transition: all 0.15s;
}
.view-btn.active { background: var(--gold); color: #000; }
.view-btn:not(.active):hover { background: var(--bg3); color: var(--text); }

/* ===== SUBTABS ===== */
.subtabs {
  display: flex;
  gap: 2px;
  margin-bottom: 1.25rem;
  border-bottom: 0.5px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  font-family: var(--font);
  white-space: nowrap;
  transition: all 0.15s;
}
.subtab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 500; }
.subtab:hover { color: var(--text); }
.lb-subtabs { border-bottom: none; margin-bottom: 1rem; }

/* ===== CARDS ===== */
.card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}
.card-title { font-size: 14px; font-weight: 600; margin-bottom: .4rem; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.detail-name { font-weight: 600; font-size: 15px; }
.detail-panel { display: none; }
.detail-panel.open { display: block; }

/* ===== METRICS ===== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 1.25rem;
}
.metric-grid.two-col { grid-template-columns: repeat(2, 1fr); }
.metric {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.metric-label { font-size: 11px; color: var(--text2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.metric-val { font-size: 22px; font-weight: 700; }
.gold { color: var(--gold); }
.green { color: var(--green); }
.amber { color: var(--amber); }
.blue { color: var(--blue); }

/* ===== FORM ===== */
.field { margin-bottom: 12px; }
label { font-size: 12px; color: var(--text2); display: block; margin-bottom: 5px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
input::placeholder { color: var(--text3); }
input:focus, select:focus { outline: none; border-color: var(--gold-border); }
select option { background: var(--bg3); }
.filter-select { width: auto; padding: 5px 10px; font-size: 12px; margin: 0; }

/* ===== BUTTONS ===== */
.btn {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border2);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  transition: all 0.15s;
  font-weight: 500;
}
.btn:hover { background: var(--bg3); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: #000; border-color: var(--gold); }
.btn-primary:hover { background: var(--gold2); }
.btn-full { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { border-color: #3a1010; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-copy { border-color: var(--gold-border); color: var(--gold); }
.btn-copy:hover { background: var(--gold-dim); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }

/* ===== MESSAGES ===== */
.msg {
  font-size: 13px;
  margin: 8px 0;
  padding: 9px 12px;
  border-radius: var(--radius);
  display: none;
}
.msg-err { background: var(--red-bg); color: var(--red); border: 0.5px solid #3a1010; }
.msg-ok { background: var(--green-bg); color: var(--green); border: 0.5px solid var(--green-border); }

/* ===== TODAY ===== */
.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .85rem;
}
.today-date { font-weight: 600; font-size: 16px; }
.today-progress { font-size: 13px; color: var(--text2); margin-top: 3px; }
.pbar { height: 6px; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.pfill { height: 100%; background: var(--gold); border-radius: 3px; transition: width .3s; }
.section-hdr {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ===== TASKS ===== */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.chk {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border2);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all 0.15s;
  font-size: 13px;
}
.chk.done { background: var(--green); border-color: var(--green); }
.task-text { flex: 1; font-size: 14px; line-height: 1.5; color: var(--text); }
.task-text.done { color: var(--text3); text-decoration: line-through; }
.complete-banner {
  text-align: center;
  font-size: 14px;
  color: var(--green);
  padding: 14px;
  background: var(--green-bg);
  border-radius: var(--radius);
  border: 0.5px solid var(--green-border);
}
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--gold-dim);
  color: var(--gold);
  border: 0.5px solid var(--gold-border);
}

/* ===== CALENDAR ===== */
.cal-hdr {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 4px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cday {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--bg3);
  color: var(--text3);
}
.cday.done { background: var(--green-bg); color: var(--green); font-weight: 600; border: 0.5px solid var(--green-border); }
.cday.partial { background: var(--amber-bg); color: var(--amber); border: 0.5px solid #3a2000; }
.cday.today { outline: 1.5px solid var(--gold); color: var(--text); }
.cday.future { opacity: .2; }
.cal-legend { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text2); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; background: var(--bg3); }
.legend-dot.done { background: var(--green-bg); border: 0.5px solid var(--green-border); }
.legend-dot.partial { background: var(--amber-bg); border: 0.5px solid #3a2000; }

/* ===== TEAM ROWS ===== */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row-info { flex: 1; min-width: 0; }
.row-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.score-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}
.score-ring.amber { border-color: var(--amber); color: var(--amber); }
.score-ring.red { border-color: var(--red); color: var(--red); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.b-ok { background: var(--green-bg); color: var(--green); border: 0.5px solid var(--green-border); }
.b-warn { background: var(--amber-bg); color: var(--amber); border: 0.5px solid #3a2000; }
.b-muted { background: var(--bg3); color: var(--text2); border: 0.5px solid var(--border); }

/* ===== AVATAR ===== */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== REFERRAL ===== */
.ref-box {
  background: var(--bg3);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 12px;
  font-family: monospace;
  word-break: break-all;
  color: var(--gold);
  margin-bottom: 10px;
  line-height: 1.6;
}
.muted-text { font-size: 13px; color: var(--text2); margin-bottom: 1rem; line-height: 1.7; }
.how-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
  color: var(--text2);
}
.how-step:last-child { border-bottom: none; }
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ===== LEADERBOARD ===== */
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}
.lb-row:last-child { border-bottom: none; }
.rank { width: 26px; text-align: center; font-size: 14px; font-weight: 700; color: var(--text2); }
.r1 { color: var(--gold); }
.r2 { color: #a0a0a0; }
.r3 { color: #cd7f32; }

/* ===== EMPTY / LOADING ===== */
.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.7; color: var(--text2); }
.loading { text-align: center; padding: 1.5rem; font-size: 13px; color: var(--text2); }

/* ===== GOAL BREAKDOWN ===== */
.breakdown-row { margin-bottom: 12px; }
.breakdown-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--text2);
}
.breakdown-count { font-weight: 600; color: var(--gold); }

/* ===== RESPONSIVE ===== */
@media (max-width: 520px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .pad { padding: 0 14px 3rem; }
  .nav { padding: 12px 14px; }
  .modal { padding: 1.5rem; }
  .nav-username { display: none; }
}

/* ===== CALENDAR NAV ===== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ===== GOLD DAY ===== */
.cday.gold-day {
  background: rgba(201,168,76,0.2);
  color: var(--gold);
  font-weight: 700;
  border: 0.5px solid var(--gold-border);
}
.legend-dot.gold-dot {
  background: rgba(201,168,76,0.2);
  border: 0.5px solid var(--gold-border);
}
.b-info { background: rgba(96,165,250,0.12); color: #60a5fa; border: 0.5px solid rgba(96,165,250,0.25); }

/* ===== WEEKLY TABLE ===== */
#t-weekly-list table tr:hover { background: var(--bg3); }

/* ===== PROSPECTS ===== */
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-sans);
  resize: vertical;
}
textarea::placeholder { color: var(--text3); }
textarea:focus { outline: none; border-color: var(--gold-border); }
