:root {
  --pink: #d81b60;
  --pink-dark: #ad1457;
  --pink-light: #fce4ec;
  --navy: #1a237e;
  --ink: #212121;
  --muted: #757575;
  --bg: #faf7f8;
  --card: #ffffff;
  --green: #2e7d32;
  --radius: 18px;
  --tabbar-h: 64px;
}

/* Investor-side palette: indigo replaces pink as the accent. */
body.mode-investor {
  --pink: #3949ab;
  --pink-dark: #283593;
  --pink-light: #e8eaf6;
  --bg: #f7f8fc;
}

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

.icon {
  width: 1.05em; height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
  display: inline-block;
}
.icon-big { width: 42px; height: 42px; color: #c9bfc4; stroke-width: 1.6; }

/* Navigation icons: stroke inherits the control's text color. */
button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button svg.filled { fill: currentColor; stroke: none; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  padding-bottom: var(--tabbar-h);
}
.screen.active { display: flex; }

/* ---------- Onboarding ---------- */
#screen-onboarding { padding-bottom: 0; overflow-y: auto; }
.onboard-inner {
  min-height: 100%;
  padding: 32px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.brand {
  color: var(--pink);
  font-size: 2.1rem;
  letter-spacing: 0.02em;
}
.tagline { color: var(--navy); font-weight: 600; }
.subtag { color: var(--pink); font-size: 0.85rem; margin-bottom: 20px; }

#signup-form { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 8px; }
#signup-form input, #signup-form select, #signup-form textarea, #login-form input {
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1rem;
  background: #fff;
  font-family: inherit;
  width: 100%;
}
#signup-form input:focus, #signup-form select:focus, #signup-form textarea:focus, #login-form input:focus { outline: none; border-color: var(--pink); }
#signup-form textarea { resize: vertical; }
#login-form { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row > div { display: flex; flex-direction: column; gap: 10px; }
.field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
.form-error {
  background: #ffebee;
  color: #b71c1c;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
.form-error.hidden { display: none; }

.ob-step { display: none; flex-direction: column; gap: 8px; }
/* Auto margins center short steps but never clip tall ones (unlike justify-content). */
.ob-step.active { display: flex; margin: auto 0; }
.ob-title { color: var(--navy); font-size: 1.4rem; margin: 4px 0 14px; }
.ob-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--pink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0 0 10px;
}
.ob-back svg { width: 18px; height: 18px; stroke-width: 2.5; }

.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-picker.stacked { grid-template-columns: 1fr; }
.role-btn {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 16px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
  font-family: inherit;
}
.role-btn.selected { border-color: var(--pink); background: var(--pink-light); }
.role-btn > svg {
  width: 30px; height: 30px;
  color: var(--pink);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.role-name { font-weight: 700; color: var(--navy); }
.role-desc { font-size: 0.72rem; color: var(--muted); }

.btn-primary {
  margin-top: 16px;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:disabled { background: #e0a5bb; cursor: default; }
.btn-primary:active:not(:disabled) { background: var(--pink-dark); }

.btn-secondary {
  margin: 16px 20px;
  background: #fff;
  color: var(--pink);
  border: 2px solid var(--pink);
  border-radius: 999px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px;
}
.topbar-title { font-size: 1.25rem; font-weight: 800; color: var(--navy); }
.topbar-badge { font-size: 0.8rem; color: var(--muted); }

.mode-toggle {
  display: flex;
  background: #eee;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.mode-toggle.hidden { display: none; }
.mode-btn {
  border: none;
  background: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.mode-btn.active { background: var(--pink); color: #fff; }

/* ---------- Discover ---------- */
.card-stack {
  flex: 1;
  position: relative;
  margin: 4px 16px 8px;
}
.profile-card {
  position: absolute;
  inset: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(26, 35, 126, 0.12);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.profile-card { touch-action: pan-y; }
.profile-card.dragging { transition: none; cursor: grabbing; user-select: none; }
.profile-card.behind { transform: scale(0.95) translateY(10px); opacity: 0.6; pointer-events: none; }

.stamp {
  position: absolute;
  top: 26px;
  padding: 6px 16px;
  border: 3px solid;
  border-radius: 10px;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.88);
  z-index: 5;
}
.stamp-like { left: 18px; color: var(--green); border-color: var(--green); transform: rotate(-14deg); }
.stamp-pass { right: 18px; color: #c62828; border-color: #c62828; transform: rotate(14deg); }
.profile-card.fly-right { transform: translateX(120%) rotate(12deg); opacity: 0; }
.profile-card.fly-left { transform: translateX(-120%) rotate(-12deg); opacity: 0; }
.profile-card.fly-up { transform: translateY(-60%) scale(0.8); opacity: 0; }

.card-head { display: flex; align-items: center; gap: 14px; }
.card-head > div:nth-child(2) { flex: 1; min-width: 0; }
.score-pill {
  background: var(--pink);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.why-match {
  background: #fff8e1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.83rem;
  line-height: 1.4;
  color: #6d4c00;
}
.avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.avatar.small { width: 36px; height: 36px; font-size: 0.95rem; }
.card-name { font-size: 1.2rem; font-weight: 800; }
.card-sub { color: var(--muted); font-size: 0.85rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--pink-light);
  color: var(--pink-dark);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.chip.navy { background: #e8eaf6; color: var(--navy); }

.card-pitch { font-size: 0.95rem; line-height: 1.5; }

.card-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fact { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.fact-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.fact-value { font-size: 0.9rem; font-weight: 700; color: var(--navy); }
.fact-sub { font-size: 0.75rem; color: var(--muted); }
.fact-wide { grid-column: 1 / -1; background: var(--pink-light); }
.fact-wide .fact-value { color: var(--pink-dark); font-size: 1.05rem; }

.ai-score {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e8f5e9;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green);
}

.stack-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.stack-empty .big { font-size: 2.5rem; }

.action-row {
  display: flex;
  justify-content: center;
  gap: 34px;
  padding: 8px 0 12px;
}
.action-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.action-label { font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.action-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.action-btn svg { width: 26px; height: 26px; }
.action-btn.pass { color: var(--muted); }
.action-btn.save { color: var(--navy); }
.action-btn.interest { background: var(--pink); color: #fff; }
.action-btn:active { transform: scale(0.92); }

/* ---------- Matches ---------- */
.matches-list { flex: 1; overflow-y: auto; padding: 8px 16px; display: flex; flex-direction: column; gap: 10px; }
.match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(26,35,126,0.07);
  border: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.match-row-main { flex: 1; min-width: 0; }
.match-row-name { font-weight: 800; font-size: 0.98rem; }
.match-row-sub { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-row-arrow { color: var(--pink); display: inline-flex; }
.match-row-arrow svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.matches-empty { text-align: center; color: var(--muted); padding: 60px 30px; }

/* ---------- Chat ---------- */
.chat-topbar { justify-content: flex-start; gap: 8px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.back-btn { background: none; border: none; color: var(--pink); cursor: pointer; padding: 0 6px; display: inline-flex; align-items: center; }
.back-btn svg { width: 26px; height: 26px; stroke-width: 2.5; }
.chat-peer { display: flex; align-items: center; gap: 10px; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.4;
}
.bubble.me { align-self: flex-end; background: var(--pink); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.08); border-bottom-left-radius: 4px; }
.bubble.system { align-self: center; background: none; color: var(--muted); font-size: 0.75rem; }

.meet-row { padding: 6px 16px 0; background: #fff; border-top: 1px solid #eee; }
.meet-chip {
  background: #e8eaf6;
  color: var(--navy);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.meet-chip svg { width: 15px; height: 15px; }
.chat-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
}
#chat-input {
  flex: 1;
  border: 2px solid #e0e0e0;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.95rem;
}
#chat-input:focus { outline: none; border-color: var(--pink); }
.btn-send {
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px; height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-send svg { width: 20px; height: 20px; }
#screen-chat { padding-bottom: 0; }

/* ---------- Profile ---------- */
.profile-body { flex: 1; overflow-y: auto; padding: 8px 20px; display: flex; flex-direction: column; gap: 12px; }
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; }
.profile-hero .avatar { width: 84px; height: 84px; font-size: 2rem; }
.verified { color: var(--green); font-size: 0.8rem; font-weight: 700; }

.section-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 10px 4px 2px;
}
.journey { display: flex; flex-direction: column; gap: 0; padding: 4px 8px; }
.journey-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 7px 0;
}
.journey-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid #cfcfcf;
  background: #fff;
}
.journey-step.done { color: var(--pink); }
.journey-step.done .journey-dot { background: var(--pink); border-color: var(--pink); }

/* ---------- Modal ---------- */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(26, 35, 126, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 24px;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff;
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-hearts svg {
  width: 56px; height: 56px;
  fill: var(--pink);
}
.modal-card h2 { color: var(--pink); }
.modal-card p { color: var(--muted); font-size: 0.92rem; }

/* ---------- Saved & booking modals ---------- */
.saved-card, .book-card { max-height: 86vh; overflow-y: auto; }
.profile-card.static {
  position: static;
  box-shadow: none;
  padding: 4px 2px 10px;
  max-height: 48vh;
  overflow-y: auto;
  text-align: left;
}
.saved-actions { display: flex; gap: 10px; }
.saved-actions > button { flex: 1; margin: 0; }
.btn-secondary.slim { padding: 13px; }
.book-title { color: var(--navy); font-size: 1.15rem; }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pick-chip {
  border: 2px solid #e0e0e0;
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.pick-chip.selected { border-color: var(--pink); background: var(--pink-light); color: var(--pink-dark); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: var(--tabbar-h);
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  z-index: 10;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar.hidden { display: none; }
.tab {
  flex: 1;
  background: none;
  border: none;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  font-family: inherit;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--pink); }
.dot {
  position: absolute;
  top: 8px; right: calc(50% - 18px);
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--pink);
}
.dot.hidden { display: none; }
