/* ============================================================
   Nexus Introducer Dashboard — shared styles
   Mirrors the admin CMS look (DM Sans, coral accent) but tuned
   for the introducer flow.
   ============================================================ */

:root {
  --accent:        #ff6d3d;
  --accent-soft:   #ff8d65;
  --accent-deep:   #e85a2c;
  --accent-tint:   #fff3ec;
  --bg:            #f6f4ef;
  --surface:       #ffffff;
  --surface-soft:  #faf8f4;
  --sidebar-bg:    #0e1c2e;
  --sidebar-soft:  #142639;
  --sidebar-line:  rgba(255, 255, 255, 0.08);
  --ink:           #0e1c2e;
  --ink-2:         #1f3045;
  --ink-3:         #4a5b73;
  --ink-soft:      #6c7c92;
  --ink-mute:      #9aa6b8;
  --line:          #e8e3da;
  --line-strong:   #d6cec0;
  --success:       #11864a;
  --success-tint:  #e6f3eb;
  --warn:          #b97810;
  --warn-tint:     #fcf2dd;
  --danger:        #d63838;
  --danger-tint:   #fbe5e5;
  --info:          #2664c4;
  --info-tint:     #e6efff;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(15, 28, 46, 0.06), 0 2px 4px rgba(15, 28, 46, 0.04);
  --shadow-2: 0 6px 18px rgba(15, 28, 46, 0.08);
  --shadow-3: 0 18px 48px rgba(15, 28, 46, 0.14);
  --sidebar-w: 240px;
  --topbar-h:  64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
code {
  background: var(--surface-soft); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.86em; font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
}

/* --- Auth screens (login + signup) --------------------------------- */
.auth-shell {
  display: grid;
  grid-template-columns: 440px 1fr;
  min-height: 100vh;
}
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
.auth-aside {
  padding: 40px 36px;
  background: linear-gradient(180deg, #0e1c2e, #122035 70%, #1d3052);
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand img { height: 28px; }
.auth-pitch h2 {
  font-size: 1.7rem;
  line-height: 1.2;
  color: #fff;
  margin: 0 0 12px;
}
.auth-pitch p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 24px;
}
.auth-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-features li {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  padding-left: 24px;
  position: relative;
}
.auth-features li::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 14px; height: 6px;
  border-left: 2px solid var(--accent-soft);
  border-bottom: 2px solid var(--accent-soft);
  transform: rotate(-45deg);
}
.auth-foot {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  padding: 36px;
}
.auth-card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent-tint);
  color: var(--accent-deep);
  padding: 4px 10px;
  border-radius: 999px;
}
.auth-card h1 {
  font-size: 1.5rem;
  margin: 12px 0 6px;
}
.auth-card .sub {
  color: var(--ink-soft);
  margin: 0 0 22px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field label {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink-2);
}
.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 109, 61, 0.18);
}
.field .hint {
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.alert {
  padding: 10px 14px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.alert-error { background: var(--danger-tint); color: var(--danger); }
.alert-success { background: var(--success-tint); color: var(--success); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 109, 61, 0.28);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-soft); }
.btn-sm { padding: 7px 12px; font-size: 0.86rem; }

.auth-link {
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 16px 0 0;
}

/* --- Dashboard layout ---------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app-sidebar {
  background: var(--sidebar-bg);
  color: rgba(255, 255, 255, 0.86);
  display: flex;
  flex-direction: column;
}
.app-sidebar-brand {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--sidebar-line);
}
.app-sidebar-brand img { height: 24px; }
.app-sidebar-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.5);
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 4px;
}
.app-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.92rem;
}
.app-sidebar-nav a:hover { background: var(--sidebar-soft); color: #fff; text-decoration: none; }
.app-sidebar-nav a.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}
.app-sidebar-nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.app-sidebar-foot {
  margin-top: auto;
  padding: 16px 22px;
  border-top: 1px solid var(--sidebar-line);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
}
.app-sidebar-foot button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
}
.app-sidebar-foot button:hover { background: rgba(255, 255, 255, 0.1); }

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
}
.app-topbar h1 { font-size: 1.1rem; margin: 0; }
.app-topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.84rem;
}

.app-content {
  padding: 28px;
  max-width: 1280px;
  width: 100%;
}

/* --- Referral link card -------------------------------------------- */
.dash-link-card {
  background: linear-gradient(135deg, #ff8d65 0%, #ff6d3d 60%, #e85a2c 100%);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 26px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(255, 109, 61, 0.28);
}
.dash-link-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -50% auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  filter: blur(20px);
}
.dash-link-card h2 { margin: 0 0 4px; font-size: 1rem; color: #fff; }
.dash-link-card p { margin: 0 0 16px; color: rgba(255, 255, 255, 0.84); font-size: 0.92rem; }
.dash-link-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  position: relative;
}
.dash-link-row input {
  flex: 1;
  font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.92rem;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #fff;
}
.dash-link-row button {
  padding: 0 18px;
  background: #fff;
  color: var(--accent-deep);
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.dash-link-row button:hover { background: rgba(255, 255, 255, 0.94); }
.dash-link-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  position: relative;
}
.dash-link-share a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 999px;
  font-size: 0.84rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.dash-link-share a:hover { background: rgba(255, 255, 255, 0.26); text-decoration: none; }
.dash-link-share svg { width: 14px; height: 14px; }

/* --- Stats grid ----------------------------------------------------- */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dash-stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
}
.dash-stat-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 700;
  margin-bottom: 6px;
}
.dash-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
}
.dash-stat-sub {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 4px;
}
.dash-stat-card.is-accent .dash-stat-value {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --- Leads table ---------------------------------------------------- */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin-bottom: 24px;
}
.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.dash-card-head h2 {
  font-size: 1rem;
  margin: 0;
}
.dash-card-head .dash-filter {
  display: flex;
  gap: 6px;
}
.dash-card-head .dash-filter button {
  padding: 6px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.dash-card-head .dash-filter button.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.dash-table-wrap { overflow-x: auto; }
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 720px;
}
.dash-table th,
.dash-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.dash-table th {
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dash-table tbody tr:hover { background: var(--surface-soft); }
.dash-table .pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: capitalize;
}
.pill-new        { background: #ffe9d8; color: #b54708; }
.pill-contacted  { background: #e0e7ff; color: #1d3b9f; }
.pill-progress   { background: #fff3c4; color: #8a5a00; }
.pill-converted  { background: #d3f6e0; color: #0e6b3b; }
.pill-rejected   { background: #fbe5e5; color: #b42424; }
.pill-pending    { background: #f0eee9; color: #5a5042; }
.pill-approved   { background: #d3f6e0; color: #0e6b3b; }
.pill-paid       { background: #cdebff; color: #134f8b; }

.dash-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
}
.dash-empty svg {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  display: block;
  color: var(--ink-mute);
}

/* --- Page preview banner ------------------------------------------- */
#preview-banner {
  background: linear-gradient(90deg, #fff7ef, #ffe5d2);
  color: var(--ink-2);
  border-bottom: 1px solid rgba(255, 109, 61, 0.22);
  padding: 8px 24px;
  font-size: 0.84rem;
  text-align: center;
}
#preview-banner strong { color: var(--accent-deep); }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    flex-direction: row;
    padding: 0;
    overflow-x: auto;
  }
  .app-sidebar-nav { flex-direction: row; padding: 8px; }
  .app-sidebar-foot { display: none; }
}
