@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --navy: #0b1f3a;
  --navy-2: #143052;
  --ink: #12263f;
  --muted: #6b778a;
  --line: #e4e9f0;
  --bg: #eef2f7;
  --card: #ffffff;
  --gold: #c9852e;
  --cream: #f3e7d6;
  --teal: #1a6b63;
  --orange: #d97706;
  --red: #c0392b;
  --radius: 16px;
  --nav-h: 64px;
  --sidebar-w: 268px;
  --font: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  --max: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 18% -5%, rgba(201, 133, 46, 0.10), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(26, 107, 99, 0.07), transparent 50%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

.app-shell.has-nav { padding-bottom: calc(var(--nav-h) + 20px); }

.app-frame {
  min-width: 0;
  width: 100%;
}

.app-main { min-width: 0; }

/* Left sidebar (desktop) */
.sidebar {
  display: none;
}

@media (min-width: 960px) {
  .app-shell.has-nav {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    padding-bottom: 0;
    min-height: 100vh;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.35rem 1.1rem 1.25rem;
    background: linear-gradient(180deg, #0b1f3a 0%, #122a4a 55%, #163557 100%);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
  }

  .sidebar-brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.75rem;
    padding: 0 0.35rem;
  }

  .sidebar-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(145deg, var(--gold), #a86b1f);
    box-shadow: 0 8px 18px rgba(201, 133, 46, 0.35);
    flex: 0 0 auto;
  }

  .sidebar .brand {
    margin: 0;
    color: #fff;
    font-size: 1.02rem;
  }

  .sidebar-tag {
    margin-top: 0.15rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .nav-caption {
    margin: 0 0 0.55rem;
    padding: 0 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
  }

  .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.72rem 0.8rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }

  .sidebar-nav a.active {
    background: rgba(201, 133, 46, 0.22);
    color: #f6c777;
  }

  .sidebar-nav svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
  }

  .nav-note {
    margin-top: auto;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-note strong {
    display: block;
    font-size: 0.95rem;
    line-height: 1.3;
    color: #fff;
  }

  .nav-note p {
    margin: 0.45rem 0 0.9rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.58);
  }

  .sidebar-cta {
    width: 100%;
    background: var(--gold);
    color: #fff;
    border: 0;
    min-height: 42px;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
  }

  .sidebar-cta:hover { transform: none; box-shadow: 0 6px 16px rgba(201, 133, 46, 0.35); }

  .app-frame {
    min-height: 100vh;
    overflow-x: hidden;
  }

  .bottom-nav { display: none !important; }

  .home-hero {
    border-radius: 0 0 22px 22px;
  }
}

.content {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
}

/* Auth */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

.auth-screen-wide {
  padding: 1.5rem 1rem 2rem;
}

.auth-layout {
  width: min(100%, 920px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: stretch;
}

@media (min-width: 860px) {
  .auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 1.5rem;
    align-items: stretch;
  }
}

.auth-card {
  width: min(100%, 440px);
  max-width: 100%;
  background: var(--card);
  border-radius: 20px;
  padding: 2rem 1.6rem;
  border: 1px solid rgba(11, 31, 58, 0.08);
  box-shadow: 0 20px 50px rgba(11, 31, 58, 0.08);
  box-sizing: border-box;
}

.auth-screen-wide .auth-card {
  width: 100%;
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.auth-links a {
  display: block;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.35;
}

.auth-promo {
  background: #0b1f3a;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(11, 31, 58, 0.12);
  box-shadow: 0 20px 50px rgba(11, 31, 58, 0.1);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.auth-promo a {
  display: block;
  line-height: 0;
}

.auth-promo img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  max-height: 520px;
}

.auth-promo-note {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  background: #fff;
}

.auth-promo-note a {
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9rem;
}

.auth-page {
  width: min(100%, 440px);
  margin: 0 auto;
  padding: 2.25rem 1.35rem 2rem;
}

.brand {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.auth-card h1,
.auth-page h1 {
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.55rem;
  color: var(--navy);
}

.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid #d5dbe5;
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: #fff;
  color: var(--ink);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid rgba(201, 133, 46, 0.35);
  border-color: var(--gold);
}

.form-grid {
  display: grid;
  gap: 0.25rem 1rem;
}

@media (min-width: 720px) {
  .form-grid.two { grid-template-columns: 1fr 1fr; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #e8e4db;
  color: #3d4654;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn + .btn { margin-top: 0.65rem; }
.btn-inline { width: auto; }

.alert {
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.alert-error { background: #fdecea; color: #8a1f17; }
.alert-success { background: #e8f6f2; color: #14574f; }
.alert-info { background: #fff7ea; color: #7a4b12; }

.demo-code {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #fff7ea;
  color: #7a4b12;
  font-size: 0.92rem;
}
.demo-code strong { font-size: 1.2rem; letter-spacing: 0.12em; }

/* Home */
.home-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, #1c4a6e 100%);
  color: #fff;
  padding: 1.5rem 0 1.75rem;
}

.home-hero-inner {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .home-hero-inner {
    grid-template-columns: 1.2fr 1fr;
    align-items: end;
  }
}

.home-hero .hi {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  opacity: 0.9;
}
.home-hero .metric-label {
  margin: 1rem 0 0.15rem;
  font-size: 0.82rem;
  opacity: 0.75;
}
.home-hero .metric-value {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.home-hero .sub-metrics {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  font-size: 0.92rem;
}
.home-hero .pending { color: #f0a24a; font-weight: 600; }
.home-hero .month { color: rgba(255,255,255,0.65); }

.promo-banner {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.9rem;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(11, 31, 58, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(11, 31, 58, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.promo-banner:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(11, 31, 58, 0.08);
}
.promo-banner img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  display: block;
}
.promo-banner-copy {
  display: grid;
  gap: 0.2rem;
  padding-right: 1rem;
}
.promo-banner-copy strong {
  color: var(--navy);
  font-size: 0.98rem;
}
.promo-banner-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.hero-actions .btn {
  width: auto;
  min-width: 150px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.hero-actions .btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.page-pad { padding: 1rem 0 0.5rem; }
.page-section {
  width: min(100% - 2rem, var(--max));
  margin: 1.25rem auto 0;
}

.home-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .home-grid {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}

.opp-card {
  background: linear-gradient(160deg, #f8efe3, #f3e7d6);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  position: relative;
  border: 1px solid rgba(201, 133, 46, 0.15);
}
.opp-card .opp-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
  padding-right: 1.5rem;
}
.opp-card .opp-dismiss {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  color: #9a8570;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.opp-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0;
  font-size: 0.88rem;
  color: #4a5568;
  border-top: 1px solid rgba(11, 31, 58, 0.06);
}
.opp-row:first-of-type { border-top: 0; }
.opp-row .amt { color: var(--teal); font-weight: 700; }

.panel {
  background: var(--card);
  border: 1px solid rgba(11, 31, 58, 0.07);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(11, 31, 58, 0.04);
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--navy);
}

.section-title {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa3b2;
  font-weight: 700;
  margin: 0.4rem 0 0.5rem;
}

.ref-list { list-style: none; margin: 0; padding: 0; }
.ref-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}
.ref-item:hover { background: #f8fafc; }
.ref-item:last-child { border-bottom: 0; }

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 0.4rem;
  background: #b0b8c4;
}
.dot-submitted { background: #9aa3b2; }
.dot-contacted { background: #7b8798; }
.dot-signed_up { background: var(--orange); }
.dot-scheduled { background: #c9852e; }
.dot-installed,
.dot-paid { background: var(--teal); }

.ref-main .title {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.98rem;
  line-height: 1.3;
}
.ref-main .sub {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 0.2rem;
}
.ref-side {
  text-align: right;
  font-size: 0.88rem;
  font-weight: 600;
  color: #6b7280;
}
.ref-side.status-submitted,
.ref-side.status-contacted { color: #6b7280; }
.ref-side.status-signed_up,
.ref-side.status-scheduled { color: var(--orange); }
.ref-side.status-installed,
.ref-side.status-paid { color: var(--teal); }
.ref-side .amt {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #9aa3b2;
}

.empty {
  padding: 2rem 1.15rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.95rem;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: min(100% - 2rem, var(--max));
  margin: 1rem auto 0.5rem;
}
.topbar a.back {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--navy);
  font-weight: 500;
}
.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--navy);
}

.detail-panel {
  width: min(100% - 2rem, var(--max));
  margin: 0.5rem auto 1.5rem;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(11, 31, 58, 0.07);
  padding: 1.25rem 1.35rem 1.5rem;
  box-shadow: 0 10px 28px rgba(11, 31, 58, 0.04);
}

.detail-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  letter-spacing: -0.02em;
  color: var(--navy);
}
.detail-head .meta {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  padding: 1.25rem 0 0.75rem;
  position: relative;
  max-width: 720px;
}
.stepper-6 {
  grid-template-columns: repeat(6, 1fr);
  max-width: 100%;
  gap: 0.15rem;
}
.stepper-6 .step .label {
  font-size: 0.65rem;
  line-height: 1.2;
}
.stepper-6 .stepper-line {
  left: 7%;
  right: 7%;
}
.step { text-align: center; position: relative; z-index: 1; }
.step .circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 auto 0.45rem;
  border: 2px solid #d5dbe5;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0.75rem;
}
.step.done .circle {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.step .label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
}
.step .date {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.stepper-line {
  position: absolute;
  top: calc(1.25rem + 14px);
  left: 12%;
  right: 12%;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}

.status-copy {
  margin: 0.5rem 0 0;
  color: #4a5568;
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 640px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 50;
  box-shadow: 0 -8px 24px rgba(11, 31, 58, 0.06);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 48px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #8b95a5;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a.active {
  color: var(--gold);
}
.bottom-nav a.active svg {
  stroke-width: 2.2;
}
.bottom-nav svg { width: 22px; height: 22px; }

@media (max-width: 959px) {
  .home-hero { padding: 1.25rem 0 1.4rem; }
  .home-hero .metric-value { font-size: 2.2rem; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; min-width: 0; justify-content: center; }
  .page-section,
  .page-title,
  .card-block,
  .form-card,
  .detail-panel,
  .topbar,
  .flash-wrap {
    width: min(100% - 1.25rem, var(--max));
  }
  .form-card,
  .detail-panel,
  .card-block,
  .panel {
    border-radius: 14px;
  }
  .stepper {
    gap: 0;
    padding-left: 0;
    padding-right: 0;
  }
  .stepper-6 .step .label { font-size: 0.55rem; }
  .stepper-6 .step .date { display: none; }
  .stepper-6 .step .circle { width: 22px; height: 22px; font-size: 0.65rem; }
  .stepper-6 .stepper-line { top: calc(1.25rem + 10px); }
  .ref-item { padding: 0.9rem 1rem; gap: 0.65rem; }
  .filters input,
  .filters select { min-width: 0; width: 100%; }
  .auth-card { padding: 1.5rem 1.2rem; border-radius: 16px; }
  .btn { min-height: 48px; }
}

.page-title {
  width: min(100% - 2rem, var(--max));
  margin: 1.25rem auto 0.5rem;
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  color: var(--navy);
}

.card-block {
  width: min(100% - 2rem, var(--max));
  margin: 0.75rem auto;
  padding: 1.15rem;
  border: 1px solid rgba(11, 31, 58, 0.07);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 28px rgba(11, 31, 58, 0.04);
}

.form-card {
  width: min(100% - 2rem, 720px);
  margin: 0.5rem auto 1.5rem;
  padding: 1.25rem;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(11, 31, 58, 0.07);
  box-shadow: 0 10px 28px rgba(11, 31, 58, 0.04);
}

.muted { color: var(--muted); font-size: 0.9rem; }
.mono { font-variant-numeric: tabular-nums; }

.profile-section-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  color: var(--navy, #0b1f3a);
}

.referral-link-card {
  margin-bottom: 1rem;
}

.referral-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
}

.referral-link-row input {
  flex: 1 1 220px;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  background: #f7f8fa;
}

.referral-link-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.home-referral-strip {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(11, 31, 58, 0.08);
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
}

.home-referral-strip .label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.2rem;
}

.home-referral-strip .link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--navy, #0b1f3a);
  word-break: break-all;
}

.payment-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.payment-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(11, 31, 58, 0.12);
  border-radius: 10px;
  background: #f7f8fa;
  cursor: pointer;
  font-size: 0.92rem;
}

.payment-mode-option:has(input:checked) {
  border-color: #0f766e;
  background: #e6f5f2;
}

.flash-wrap {
  width: min(100% - 2rem, var(--max));
  margin: 1rem auto 0;
}
