@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --navy: #132043;
  --navy-2: #1d2f5e;
  --content: #F6F7F9;
  --coral: #FF6B57;
  --coral-dark: #e8553f;
  --ink: #1c2333;
  --muted: #6b7280;
  --card: #ffffff;
  --line: #e5e7eb;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  --green: #047857;
  --green-bg: #d1fae5;
  --grey-bg: #e5e7eb;
  --pink-bg: #fce7f3;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

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

body { font-family: 'Poppins', sans-serif; background: var(--content); color: var(--ink); }

a { color: var(--coral-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 245px; flex: 0 0 245px; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .wordmark { font-weight: 700; font-size: 20px; letter-spacing: .5px; padding: 4px 10px 18px; color:#fff; }
.sidebar .wordmark span { color: var(--coral); }
.sidebar .user { display:flex; align-items:center; gap:10px; padding: 10px; background: rgba(255,255,255,.06); border-radius: var(--radius); margin-bottom: 18px; }
.sidebar .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--coral); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; overflow:hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.vtick { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--green); color: #fff; font-size: 10px; font-weight: 700; margin-left: 6px; vertical-align: middle; }
/* Referrer badge on referral pages */
.ref-badge { display: inline-flex; align-items: center; gap: 8px; }
.avatar.circle { width: 34px; height: 34px; border-radius: 50%; background: var(--coral); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; overflow: hidden; flex: none; }
.ref-badge .vtick { color: #fff; }
.sidebar .uname { font-size: 13px; font-weight: 600; }
.sidebar .ubadge { font-size: 10px; color: #86efac; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: #cbd5e1; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color:#fff; text-decoration:none; }
.sidebar nav a.active { background: var(--coral); color: #fff; }
.sidebar .logout { margin-top: 10px; border: 1px solid rgba(255,255,255,.25); background: none; color:#cbd5e1; }
.sidebar .logout:hover { color:#fff; }

.content { flex: 1; padding: 24px 28px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.topbar h2 { font-size: 22px; font-weight: 600; }
.hamburger { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 18px; cursor: pointer; }
.support { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 13px; color: var(--muted); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card p.dim { color: var(--muted); font-size: 13px; }

.banner { background: var(--pink-bg); border: 1px solid #fbcfe8; color: #9d174d; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.banner .btn { white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.coral .v { color: var(--coral-dark); }
.stat.blue .v { color: var(--blue); }
.stat.green .v { color: var(--green); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 20px; }

/* Buttons */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 10px 18px; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; background: var(--coral); color: #fff; text-decoration: none; }
.btn:hover { background: var(--coral-dark); text-decoration: none; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--content); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #fff; margin-bottom: 14px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--coral); border-color: transparent; }
.field-hint { font-size: 12px; color: var(--muted); margin: -8px 0 12px; }
.error { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; display: none; }
.error.show { display: block; }
.success { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; display: none; }
.success.show { display: block; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.eligible { background: var(--blue-bg); color: var(--blue); }
.badge.issued { background: var(--green-bg); color: var(--green); }
.badge.void, .badge.voided { background: var(--grey-bg); color: var(--muted); }
.badge.new { background: var(--blue-bg); color: var(--blue); }
.badge.purchased { background: var(--green-bg); color: var(--green); }
.badge.contacted { background: var(--amber-bg); color: var(--amber); }

/* Ladder */
.ladder .row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ladder .row:last-child { border-bottom: none; }
.ladder .val { width: 70px; font-weight: 700; font-size: 16px; }
.ladder .mark { width: 26px; height: 26px; border-radius: 50%; background: var(--grey-bg); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 13px; }
.ladder .row.current .mark { background: var(--coral); color: #fff; }
.ladder .row.reached .mark { background: var(--green); color: #fff; }
.ladder .row .desc { font-size: 13px; color: var(--muted); }

/* Link / SMS cards */
.linkbox { display: flex; gap: 8px; margin-top: 4px; }
.linkbox input { margin-bottom: 0; flex: 1; font-size: 13px; }
.smsbox { width: 100%; min-height: 110px; resize: vertical; font-size: 13px; }

/* Plain / auth pages */
.plain { background: var(--navy); color: #fff; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { position: relative; z-index: 1; }
.center-splash { text-align: center; }
.auth-card { background: var(--card); color: var(--ink); border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-brand { display: block; text-align: center; font-weight: 700; font-size: 20px; color: var(--navy); text-decoration: none; margin-bottom: 16px; }
.auth-brand span { color: var(--coral); }
.auth-brand:hover { color: var(--navy); text-decoration: none; opacity: .85; }
.auth-card .foot { font-size: 12px; color: var(--muted); text-align: center; margin-top: 16px; }
.auth-actions { display: flex; gap: 12px; margin-top: 60px; }
.auth-actions .btn { flex: 1; text-align: center; }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--muted); }
.auth-links { margin-top: 8px; }

/* Busy overlay */
.busy { position: fixed; inset: 0; z-index: 200; background: rgba(19,32,67,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.busy-box { background: #fff; color: var(--ink); border-radius: 12px; padding: 26px 34px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.35); font-size: 14px; font-weight: 500; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--coral); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.guide-cta { margin-top: 24px; }

/* Landing */
.landing { background: linear-gradient(155deg, #132043 0%, #172a55 35%, #1e2f5e 60%, #381f45 100%); background-size: 200% 200%; animation: landingDrift 18s ease-in-out infinite; color: #fff; min-height: 100vh; }
@keyframes landingDrift { 0%, 100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }
.landing .hero { max-width: 1080px; margin: 0 auto; padding: 40px 24px 60px; }
.landing .nav { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; max-width: 1080px; margin: 0 auto; }
.landing .nav, .landing .hero, .landing .how, .landing .foot { position: relative; z-index: 1; }
.landing .wordmark { font-weight: 700; font-size: 20px; color: #fff; text-decoration: none; }
.landing .wordmark:hover { color: #fff; text-decoration: none; opacity: .92; }
.landing .wordmark span { color: var(--coral); }
.landing h1 { font-size: 40px; line-height: 1.15; margin: 10px 0 14px; font-weight: 700; }
.landing h1 span { color: var(--coral); }
.landing .lead { font-size: 16px; color: #cbd5e1; max-width: 560px; margin-bottom: 28px; }
.landing .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.landing .cta .btn.ghost { background: transparent; border-color: #33406b; color: #fff; }
.landing .how { background: var(--content); color: var(--ink); border-radius: 20px; padding: 36px 28px; }
.landing .how h2 { font-size: 24px; margin-bottom: 20px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step .n { width: 30px; height: 30px; border-radius: 50%; background: var(--coral); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 10px; }
.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p { font-size: 13px; color: var(--muted); }
.landing .tiers { margin-top: 28px; }
.tierrow { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.tierrow .val { font-size: 20px; font-weight: 700; width: 90px; }
.tierrow .desc { font-size: 13px; color: var(--muted); flex: 1; }
.landing .faq { margin-top: 28px; }
.landing .faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.landing .faq summary { font-weight: 600; font-size: 14px; cursor: pointer; }
.landing .faq p { font-size: 13px; color: var(--muted); margin-top: 8px; }
.landing .foot { text-align: center; padding: 24px; color: #64748b; font-size: 12px; }

@media (max-width: 767px) {
  .shell { display: block; }
  .sidebar { width: 100%; height: auto; position: static; display: none; padding: 14px; }
  .sidebar.open { display: flex; }
  .hamburger { display: inline-block; }
  .content { padding: 16px; }
  .landing h1 { font-size: 30px; }
  .landing .nav .btn { display: none; }
}
