/* ── Reset ── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --green:       #2DCD70;
  --green-d:     #1AAD5C;
  --green-dd:    #0F8A45;
  --green-l:     #F0FDF6;
  --green-m:     #DCFCE7;
  --green-glow:  rgba(45,205,112,0.15);
  --green-glass: rgba(45,205,112,0.08);

  --white:       #FFFFFF;
  --off-white:   #F8FAFB;
  --surface:     #F2F5F7;
  --card:        #FFFFFF;
  --border:      rgba(0,0,0,0.07);
  --border-g:    rgba(45,205,112,0.25);

  --text:        #0F1923;
  --text-2:      #3D4E5C;
  --text-3:      #7A8C9A;
  --text-4:      #B0BEC5;

  --red:         #FF3B5C;
  --red-l:       #FFF0F3;
  --orange:      #FF8C42;
  --orange-l:    #FFF4ED;
  --blue:        #2563EB;
  --blue-l:      #EFF6FF;
  --purple:      #7C3AED;
  --purple-l:    #F5F3FF;
  --yellow:      #F59E0B;
  --yellow-l:    #FFFBEB;
  --teal:        #0EA5E9;
  --teal-l:      #F0F9FF;

  --glass-bg:     rgba(255,255,255,0.9);
  --glass-border: rgba(255,255,255,0.95);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.08);

  --shadow-xs:   0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.07);
  --shadow:      0 4px 20px rgba(0,0,0,0.09);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.12);
  --shadow-green: 0 8px 24px rgba(45,205,112,0.3);

  --r-xs:   6px;  --r-sm:  10px;
  --r:     14px;  --r-lg:  20px;
  --r-xl:  28px;  --r-full: 9999px;

  --font-display: 'Syne', sans-serif;
  --font:         'DM Sans', sans-serif;

  --sidebar-w: 260px;
  --topbar-h:  62px;
  --nav-h:     68px;
}

[data-theme="dark"] {
  --white:       #0D1117;
  --off-white:   #161B22;
  --surface:     #1C2128;
  --card:        #21262D;
  --border:      rgba(255,255,255,0.08);
  --border-g:    rgba(45,205,112,0.2);
  --text:        #E6EDF3;
  --text-2:      #8B949E;
  --text-3:      #6E7681;
  --text-4:      #3D444D;
  --glass-bg:    rgba(13,17,23,0.92);
  --glass-border: rgba(255,255,255,0.06);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-xs:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.35);
  --shadow:      0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg:   0 16px 48px rgba(0,0,0,0.6);

  /* ── FIX: dark-mode-safe tint backgrounds ──────────────────────────────
     These "-l" (light-tint) tokens were previously undefined in dark
     mode, so they silently fell back to their :root value — a solid,
     near-white pale hex (e.g. --green-l: #F0FDF6) designed to sit on a
     light page. Paired with --text, which in dark mode is near-white
     (#E6EDF3), that gave near-invisible text on a near-white pill —
     the low-contrast bug reported on the waitlist survey, and the same
     issue affects every other consumer of these tokens: pill-green,
     pill-blue, pill-orange, pill-red, pill-yellow, pill-purple,
     btn-outline:hover, btn-icon:hover, and any component-level inline
     style built the same way. Fixed by making every "-l"/"-m" tint a
     translucent overlay of its brand color instead of a solid pale hex,
     so it reads correctly against a dark card regardless of what sits
     underneath it. ──────────────────────────────────────────────────── */
  --green-l:   rgba(45,205,112,0.16);
  --green-m:   rgba(45,205,112,0.26);
  --red-l:     rgba(255,59,92,0.16);
  --orange-l:  rgba(255,140,66,0.16);
  --blue-l:    rgba(37,99,235,0.18);
  --purple-l:  rgba(124,58,237,0.18);
  --yellow-l:  rgba(245,158,11,0.16);
  --teal-l:    rgba(14,165,233,0.18);

  /* The light-mode "dd" text tone (e.g. --green-dd: #0F8A45) was tuned
     for contrast against a solid pale background, not a translucent
     overlay on a dark card — brightened here so labels stay readable. */
  --green-dd:  #34D399;
}

/* pill-orange / pill-red / pill-yellow use hardcoded hex text colors
   (not CSS variables) in their base rule below, so they need their own
   explicit dark-mode override — a variable swap alone won't reach them. */
[data-theme="dark"] .pill-orange { color: #FFA463; }
[data-theme="dark"] .pill-red    { color: #FF6B85; }
[data-theme="dark"] .pill-yellow { color: #FBBF24; }

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── App layout ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── BOTTOM NAV - REMOVED CONFLICTING STYLES ── */
/* The unique SVG notch bottom nav is now handled entirely by BottomNav.jsx */
/* No CSS overrides here - let the component control its own destiny */

@media (max-width: 900px) {
  .main-content {
    margin-left: 0 !important;
    padding-bottom: 85px; /* Space for the SVG notch nav */
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .page-content { padding: 14px; }
  .topbar { padding: 0 14px; }
}

@media (min-width: 901px) {
  .sidebar { transform: translateX(0) !important; }
}

/* Auth */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--white);
  border-radius: 28px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-green);
  transition: all 0.15s;
}

.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(45,205,112,0.4); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  width: 100%;
  height: 52px;
  background: transparent;
  color: var(--green-d);
  border: 1.5px solid var(--green);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}

.btn-outline:hover:not(:disabled) { background: var(--green-l); }

.btn-ghost {
  background: none;
  border: none;
  color: var(--green-d);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  padding: 4px 8px;
  transition: color 0.15s;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover { background: var(--green-l); border-color: var(--border-g); }

/* ── Inputs — fixed focus-loss bug ── */
.input-field {
  width: 100%;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  padding: 2px 0;
}

.input-field::placeholder { color: var(--text-4); }

.input-underline {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1.5px solid var(--border);
  padding: 8px 4px;
  transition: border-color 0.2s;
  margin-bottom: 20px;
}

.input-underline:focus-within { border-bottom-color: var(--green); }

.input-label-top {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 5px;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
}

/* ── Pills ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill-green  { background: var(--green-m);  color: var(--green-dd); }
.pill-blue   { background: var(--blue-l);   color: var(--blue); }
.pill-orange { background: var(--orange-l); color: #C05A1A; }
.pill-red    { background: var(--red-l);    color: #CC0033; }
.pill-gray   { background: var(--surface);  color: var(--text-3); border: 1px solid var(--border); }
.pill-yellow { background: var(--yellow-l); color: #B45309; }
.pill-purple { background: var(--purple-l); color: var(--purple); }

/* ── Avatar ── */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font);
  user-select: none;
}

/* ── Banner ── */
.banner {
  background: linear-gradient(135deg, var(--green), var(--green-d));
  border-radius: 20px;
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-green);
}
.banner::before { content: ''; position: absolute; top:-50px; right:-50px; width:160px; height:160px; background:rgba(255,255,255,0.1); border-radius:50%; }
.banner::after  { content: ''; position: absolute; bottom:-40px; right:30px; width:100px; height:100px; background:rgba(255,255,255,0.06); border-radius:50%; }

/* ── Listing card ── */
.listing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-xs);
}
.listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-g); }

/* ── CHAT BUBBLES — THE DEFINITIVE FIX ── */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.msg-row.sent {
  flex-direction: row-reverse;
}

.msg-row.recv {
  flex-direction: row;
}

.msg-bubble-sent {
  max-width: 70%;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: white;
  border-radius: 18px 4px 18px 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(45,205,112,0.25);
}

.msg-bubble-recv {
  max-width: 70%;
  padding: 10px 14px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: var(--shadow-xs);
}

.msg-time {
  font-size: 10px;
  color: var(--text-4);
  margin-top: 3px;
  white-space: nowrap;
}

/* ── Steps ── */
.steps { display: flex; align-items: center; margin-bottom: 24px; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; transition: all 0.3s;
}
.step-dot.done   { background: var(--green); color: white; }
.step-dot.active { background: var(--green); color: white; box-shadow: 0 0 0 4px var(--green-glow); }
.step-dot.todo   { background: var(--surface); color: var(--text-4); border: 2px solid var(--border); }
.step-line { flex: 1; height: 2px; transition: background 0.3s; }
.step-line.done { background: var(--green); }
.step-line.todo { background: var(--border); }
.step-label { font-size: 10px; font-weight: 600; color: var(--text-4); margin-top: 4px; text-align: center; white-space: nowrap; }
.step-label.active { color: var(--green-d); font-weight: 700; }

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ── Animations ── */
@keyframes fadeIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
@keyframes breathe { 0%,100%{transform:scale(1);box-shadow:0 8px 24px rgba(45,205,112,0.3)} 50%{transform:scale(1.05);box-shadow:0 16px 40px rgba(45,205,112,0.5)} }
@keyframes pulse-ring { 0%{transform:scale(1);opacity:0.5} 100%{transform:scale(1.5);opacity:0} }
@keyframes loadBar { from{width:0} to{width:100%} }
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
@keyframes spin { to{transform:rotate(360deg)} }
@keyframes slideUp { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:translateY(0)} }

.fade-in  { animation: fadeIn 0.3s ease forwards; }
.slide-up { animation: slideUp 0.4s ease forwards; }

/* Hamburger — only on mobile */
.hamburger-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: none;   
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .hamburger-btn {
    display: flex;
  }
}