/* ==========================================================================
 * PocketFund — Logged-in portal styles (founder + investor + discussions)
 * ==========================================================================
 *
 * Loaded by every /app/* page (founder portal + investor portal). NOT loaded
 * by marketing pages — they pull styles.css directly. Both stylesheets share
 * the same :root design tokens (defined in styles.css) so theme switching
 * works seamlessly when navigating between marketing and portal pages.
 *
 * --------------------------------------------------------------------------
 * High-level layout
 * --------------------------------------------------------------------------
 *   1. Native form-widget normalisation (select / option dropdown styling)
 *   2. Layout shell (.portal-shell, sticky save/cancel bar)
 *   3. Form interactions (foldable cards, avatar picker, save/wishlist heart)
 *   4. Project-progress widget (initiation → closure ring)
 *   5. Foldable related-investors panel
 *   6. Caricature / cartoon / initials / photo avatar wrappers
 *   7. Portal navbar (.portal-bar, two-row layout, theme picker position)
 *   8. Empty states + page heads + crumbs
 *   9. Project grid + project cards
 *  10. New-project CTA + form repeaters (artefacts, links, files)
 *  11. Investor list (related-investors, Initiate-discussion rows)
 *  12. Discussion / messaging shell (feed, compose, bid leaderboard)
 *  13. Filter panel (browse), lock banner (NDA-gated views), modals
 *  14. Compact match-% pill variant on project cards
 *  15. Profile pages (.profile-grid, .profile-side, .profile-meta)
 *  16. Founder-blocks (.founder-block, .fb-head, .facet-grid, chevron)
 *  17. Credentials rows (.creds-row, .creds-row-merged)
 *  18. Sub-profile cards + nested team-member sections
 *  19. Activity feed (account profile)
 *  20. Responsive @media rules
 *
 * --------------------------------------------------------------------------
 * Conventions
 * --------------------------------------------------------------------------
 *   - All design tokens (colours, spacing, shadows) come from styles.css.
 *   - Component classes are flat — no BEM. Most class names are unique
 *     enough that grepping finds them in one shot.
 *   - data-attributes drive interactive behaviour (data-fb-toggle,
 *     data-tm-pic, data-cof-photo, etc.) — see portal.js.
 * ========================================================================= */
/* (legacy file header retained):
   Layered on top of styles.css — pulls in tokens, buttons, chips, fields. */

/* Tell the browser to render native form widgets (incl. <select> dropdown
   panels and <option> rows) in dark mode so they're readable on our bg. */
:root { color-scheme: dark; }

/* Force readable colours on every native option, regardless of where the
   select is used. Some browsers (Chrome on Win) need explicit values. */
select, option {
  background-color: #141833;
  color: #eef0fb;
}
option:checked, option:hover {
  background-color: #1c2139;
  color: #fff;
}
/* Custom-styled select trigger (the closed control) */
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%239aa3c7' stroke-width='2'><path d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px !important;
}

.portal-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }

/* ==========================================================================
 * 2. Layout shell + sticky actions
 * ========================================================================= */

/* Sticky save/cancel bar — used at the bottom of long edit forms so the
   action buttons are always reachable without scrolling. */
.sticky-actions {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 16px;
  margin: 22px -16px 0;
  background: linear-gradient(180deg, rgba(11,13,23,0), var(--bg) 30%);
  border-top: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
[data-theme="daylight"] .sticky-actions, [data-theme="paper"] .sticky-actions,
[data-theme="mint"] .sticky-actions, [data-theme="sky"] .sticky-actions {
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--bg) 30%);
  border-top-color: var(--border);
}

/* ==========================================================================
 * 3. Form interactions (foldable cards, avatar picker, save/heart button)
 * ========================================================================= */

/* Foldable form-card — same look as .form-card but the body collapses
   behind a click-to-expand head. */
.form-fold .form-fold-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  cursor: pointer; user-select: none;
}
.form-fold .form-fold-head .arrow {
  width: 28px; height: 28px; border-radius: 9px;
  background: rgba(var(--brand-rgb), .08);
  border: 1px solid rgba(var(--brand-rgb), .25);
  display: grid; place-items: center; color: var(--brand);
  transition: transform .2s, background .2s;
  flex-shrink: 0;
}
.form-fold .form-fold-body { display: none; margin-top: 18px; }
.form-fold.open .form-fold-body { display: block; }
.form-fold.open .form-fold-head .arrow { transform: rotate(180deg); }

/* Project-progress widget — initiation → closure ring + label. */
.proj-progress {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 12.5px;
  min-width: 200px;
}
.proj-progress .ring {
  --pct: 0%;
  width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(var(--brand) var(--pct), rgba(255,255,255,.08) 0);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.proj-progress .ring::before {
  content: ""; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg, #0b0d17);
  position: absolute;
}
.proj-progress .ring { position: relative; }
.proj-progress .ring b { position: relative; font-size: 11px; font-weight: 800; }
.proj-progress .info { line-height: 1.25; }
.proj-progress .info b { display: block; font-size: 13px; }
.proj-progress .info span { color: var(--muted); font-size: 11px; }

/* Foldable related-investors panel under project cards. */
.fold {
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.07);
  margin-top: 10px;
  overflow: hidden;
}
.fold-head {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text);
}
.fold-head:hover { background: rgba(255,255,255,.03); }
.fold-head .arrow {
  width: 24px; height: 24px; border-radius: 8px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  display: grid; place-items: center;
  transition: transform .2s;
}
.fold-head .arrow svg { width: 12px; height: 12px; }
.fold.open > .fold-head .arrow { transform: rotate(180deg); background: rgba(var(--brand-rgb),.15); border-color: rgba(var(--brand-rgb),.4); }
.fold-body { display: none; padding: 6px 14px 14px; }
.fold.open > .fold-body { display: block; }
.fold-body .investor-row { padding: 10px; }
.fold-body .investor-row .av { width: 36px; height: 36px; }

/* Save / wishlist heart button — appears on cards and rows. */
.save-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--muted); cursor: pointer;
  transition: all .15s;
}
.save-btn:hover { background: rgba(var(--accent-rgb),.12); border-color: rgba(var(--accent-rgb),.4); color: #ffb8dd; }
.save-btn.on    { background: rgba(var(--accent-rgb),.22); border-color: rgba(var(--accent-rgb),.6); color: var(--accent); }
.save-btn svg { width: 15px; height: 15px; }

/* Avatar style picker on the profile edit form. */
.av-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.av-picker .av-opt {
  padding: 12px; border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .15s, transform .15s;
}
.av-picker .av-opt:hover { border-color: rgba(var(--brand-rgb),.4); transform: translateY(-1px); }
.av-picker .av-opt.on { border-color: rgba(var(--brand-rgb),.7); background: rgba(var(--brand-rgb),.1); }
.av-picker .av-preview {
  width: 56px; height: 56px; border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03);
}
.av-picker .av-preview svg, .av-picker .av-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-picker .av-opt b { font-size: 12.5px; font-weight: 600; }
.av-picker .av-opt span { color: var(--muted); font-size: 11px; text-align: center; }
.av-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.av-actions input[type="color"] { width: 44px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: transparent; }
.av-actions input[type="text"] { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); color: var(--text); font-family: inherit; font-size: 13px; min-width: 220px; }
.av-actions .pill {
  padding: 7px 12px; border-radius: 9px; font-size: 12.5px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  color: var(--text); cursor: pointer;
}
.av-actions .pill:hover { background: rgba(var(--brand-rgb),.12); border-color: rgba(var(--brand-rgb),.35); }

/* ==========================================================================
 * 6. Avatar wrappers (.pf-av sizes, caricature SVG portraits)
 * --------------------------------------------------------------------------
 * Avatars come in four flavours (set by user.avatar.style):
 *   caricature → SVG-drawn portrait (procedurally generated by PF.avatarSvg)
 *   cartoon    → simpler SVG illustration
 *   initials   → flat coloured tile with first/last initials
 *   photo      → uploaded image data-URL
 * The wrappers below ensure all four render at consistent sizes regardless
 * of source, and stay round + bordered.
 * ========================================================================= */

/* Caricature avatar wrapper — keeps SVG portraits round and well-bordered. */
.pf-av {
  display: inline-grid; place-items: stretch;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  flex-shrink: 0;
  line-height: 0;
}
.pf-av.sq { border-radius: 12px; }
.pf-av svg, .pf-av img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pf-av.s24 { width: 24px; height: 24px; }
.pf-av.s32 { width: 32px; height: 32px; }
.pf-av.s40 { width: 40px; height: 40px; }
.pf-av.s44 { width: 44px; height: 44px; }
.pf-av.s64 { width: 64px; height: 64px; }
.pf-av.s96 { width: 96px; height: 96px; border-radius: 24px; }

/* --- Top bar --- */
.portal-bar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11,13,23,.78);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.portal-bar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px;
  display: flex; align-items: center; gap: 24px;
}

/* --- Stacked portal nav (after rebuildPortalNav) ---
   Top row = the standard marketing menu; bottom row = the role-specific
   portal items aligned under the matching main link (For founders /
   For investors). Background and sticky behaviour stay the same. */
.portal-bar.portal-bar-stacked {
  padding: 0;
  background: rgba(11,13,23,.85);
}
[data-theme="daylight"] .portal-bar.portal-bar-stacked,
[data-theme="paper"]    .portal-bar.portal-bar-stacked,
[data-theme="mint"]     .portal-bar.portal-bar-stacked,
[data-theme="sky"]      .portal-bar.portal-bar-stacked {
  background: rgba(255,255,255,.78);
  border-bottom-color: var(--border);
}

.portal-bar-stacked .portal-top-row {
  height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.portal-bar-stacked .portal-top-row .nav-links {
  display: flex; align-items: center; gap: 28px;
}
.portal-bar-stacked .portal-top-row .nav-links a {
  font-size: 14.5px; color: var(--muted); font-weight: 500;
  transition: color .15s;
}
.portal-bar-stacked .portal-top-row .nav-links a:hover {
  color: var(--text);
}
.portal-bar-stacked .portal-top-row .nav-links a.portal-anchor {
  color: var(--text);
}
.portal-bar-stacked .portal-top-row .nav-links a.portal-anchor::after {
  content: ""; display: block; height: 2px; margin-top: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 2px;
}

.portal-subnav-row {
  height: 50px;
  display: flex; align-items: center;
  border-top: 1px solid rgba(255,255,255,.05);
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
}
[data-theme="daylight"] .portal-subnav-row,
[data-theme="paper"]    .portal-subnav-row,
[data-theme="mint"]     .portal-subnav-row,
[data-theme="sky"]      .portal-subnav-row {
  border-top-color: var(--border);
}
.portal-subnav-links {
  display: flex; gap: 4px; flex-wrap: wrap;
  /* margin-left set by JS to align the first item under the matching
     top-level link ("For founders" or "For investors"). */
}
.portal-subnav-links a {
  padding: 7px 14px; border-radius: 9px;
  font-size: 13.5px; font-weight: 500;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all .15s;
}
.portal-subnav-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}
.portal-subnav-links a.active {
  color: var(--text);
  background: rgba(var(--brand-rgb), .14);
  border-color: rgba(var(--brand-rgb), .35);
}
[data-theme="daylight"] .portal-subnav-links a:hover,
[data-theme="paper"]    .portal-subnav-links a:hover,
[data-theme="mint"]     .portal-subnav-links a:hover,
[data-theme="sky"]      .portal-subnav-links a:hover {
  background: rgba(0,0,0,.04);
}

/* ==========================================================================
 * 7. Portal navbar (rebuilt by portal.js into a two-row layout)
 * --------------------------------------------------------------------------
 * portal.js's rebuildPortalNav() replaces the simple .portal-bar header
 * with a top row (marketing nav + auth) and a sub-row (portal page tabs).
 * The styles below cover both the rebuilt structure and the .portal-tabs
 * inner-page tab strip used on discussions-list.html.
 * ========================================================================= */

/* Hide the legacy .portal-tabs (still in the DOM after rebuild as innerHTML
   source — but we replaced bar.textContent so it's gone; keep this rule for
   safety in case any inline scripts re-render it). */
.portal-tabs { display: none; }
.portal-bar-stacked .portal-subnav-links { display: flex !important; }

/* --- User-account popup ---
   Click the avatar / name area to open. Sits anchored to .portal-user. */
.portal-user { position: relative; }
.user-popover {
  position: absolute; top: calc(100% + 12px); right: 0;
  min-width: 240px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 100;
  text-align: left;
}
.user-popover.open { display: block; }
.user-popover-head {
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  line-height: 1.3;
}
.user-popover-head b { display: block; font-size: 14px; color: var(--text); }
.user-popover-head small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.user-popover a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--text); font-size: 13.5px; font-weight: 500;
  cursor: pointer;
}
.user-popover a:hover {
  background: rgba(var(--brand-rgb), .1);
}
.user-popover a svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); }
.user-popover a.logout {
  color: #ff8b8b;
  border-top: 1px solid var(--border);
  margin-top: 6px; padding-top: 12px;
}
.user-popover a.logout svg { color: #ff8b8b; }
.portal-bar-inner .brand { font-size: 16px; }
.portal-tabs { display: flex; gap: 4px; margin-left: 8px; }
.portal-tabs a {
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 500;
  color: var(--muted); border: 1px solid transparent;
}
.portal-tabs a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.portal-tabs a.active {
  color: var(--text);
  background: rgba(var(--brand-rgb),.14);
  border-color: rgba(var(--brand-rgb),.35);
}
.portal-user {
  margin-left: auto; display: flex; align-items: center; gap: 12px;
  font-size: 13.5px; color: var(--muted);
  position: relative;
}
/* Theme picker sits to the LEFT of the profile name + avatar block. */
.portal-user .theme-toggle {
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.08);
}
.portal-user .theme-toggle .theme-btn {
  width: 36px; height: 36px;
}
.portal-user .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.portal-user .who b { color: var(--text); font-size: 13.5px; }
.portal-user .who span { font-size: 11.5px; }
.portal-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #ffb057, var(--accent));
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 13px;
  overflow: hidden; line-height: 0;
  border: 1px solid rgba(255,255,255,.08);
}
.portal-avatar.b { background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.portal-avatar svg, .portal-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }

.portal-main { max-width: 1280px; margin: 0 auto; padding: 36px 24px 80px; width: 100%; }

/* --- Page heads --- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: 28px;
}
.page-head h1 {
  margin: 0; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.5px; font-weight: 700;
}
.page-head .crumb {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; margin-bottom: 6px;
}
.page-head .crumb a { color: var(--muted); }
.page-head .crumb a:hover { color: var(--text); }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

/* --- Project list grid --- */
.project-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px;
  align-items: start;
}
.project-card-wrap { display: flex; flex-direction: column; }
.project-card {
  position: relative;
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  transition: transform .2s, border-color .2s;
  display: flex; flex-direction: column; gap: 14px;
}
.project-card:hover { transform: translateY(-2px); border-color: rgba(var(--brand-rgb),.4); }
.project-card .pc-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.project-card h3 { margin: 0; font-size: 19px; letter-spacing: -.2px; }
.project-card .blurb { color: var(--muted); font-size: 14px; margin: 0; }
.project-card .pc-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 12px; border-radius: 12px;
  background: rgba(var(--brand-rgb),.06); border: 1px solid rgba(var(--brand-rgb),.18);
}
.pc-stats div { text-align: center; }
.pc-stats b { display: block; font-size: 14px; color: var(--text); }
.pc-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.project-card .pc-arts {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.art-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; color: var(--muted);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
}
.art-tag b { color: var(--text); font-weight: 600; }
.project-card .pc-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px; border-top: 1px solid rgba(255,255,255,.06);
  font-size: 12.5px; color: var(--muted);
}

/* New project CTA card */
.new-project-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 26px; margin-bottom: 28px;
  border-radius: 18px;
  background: radial-gradient(400px 200px at 0% 0%, rgba(var(--brand-rgb),.3), transparent),
              radial-gradient(360px 180px at 100% 100%, rgba(var(--brand-2-rgb),.2), transparent),
              rgba(255,255,255,.02);
  border: 1px solid rgba(var(--brand-rgb),.35);
}
.new-project-cta .npc-text h3 { margin: 0 0 4px; font-size: 19px; }
.new-project-cta .npc-text p { margin: 0; color: var(--muted); font-size: 14px; }

/* --- Empty states --- */
.empty-state {
  text-align: center; padding: 60px 24px;
  border: 1px dashed rgba(255,255,255,.12); border-radius: 18px;
  background: rgba(255,255,255,.02);
}
.empty-state .ico {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 18px;
  background: rgba(var(--brand-rgb),.15); border: 1px solid rgba(var(--brand-rgb),.35);
  display: grid; place-items: center; color: #c8bcff;
}
.empty-state h3 { margin: 0 0 6px; font-size: 19px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }

/* --- NDA layout --- */
.nda-wrap { display: grid; grid-template-columns: 1.5fr 1fr; gap: 36px; }
.nda-doc {
  padding: 36px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.08);
  max-height: 70vh; overflow-y: auto;
}
.nda-doc h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.3px; }
.nda-doc .meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.nda-doc h4 { margin: 22px 0 8px; font-size: 14.5px; color: #c8bcff; letter-spacing: .3px; }
.nda-doc p, .nda-doc li { color: var(--muted); font-size: 14px; line-height: 1.65; }
.nda-doc p { margin: 0 0 12px; }
.nda-doc ul { padding-left: 20px; margin: 0 0 14px; }
.nda-sign {
  position: sticky; top: 90px; align-self: start;
  padding: 24px; border-radius: 18px;
  background: rgba(var(--brand-rgb),.06); border: 1px solid rgba(var(--brand-rgb),.3);
}
.nda-sign h3 { margin: 0 0 6px; font-size: 17px; }
.nda-sign p { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.nda-checks label {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.nda-checks input { accent-color: var(--brand); margin-top: 3px; }

/* --- New project form --- */
.form-wrap {
  display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start;
}
.form-card {
  padding: 28px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 18px;
}
.form-card h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.2px; }
.form-card p.section-sub { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.form-card .field label { font-size: 12.5px; }
.form-aside {
  position: sticky; top: 90px;
  padding: 22px; border-radius: 18px;
  background: rgba(var(--brand-2-rgb),.05); border: 1px solid rgba(var(--brand-2-rgb),.25);
}
.form-aside h4 { margin: 0 0 8px; font-size: 14.5px; color: #bdebff; }
.form-aside ul { color: var(--muted); padding-left: 18px; margin: 0; font-size: 13.5px; line-height: 1.7; }
.chip-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-picker .chip { cursor: pointer; user-select: none; }
.chip-picker .chip.on {
  background: linear-gradient(135deg, var(--brand), var(--brand));
  border-color: transparent; color: white;
}

/* Repeater rows (presentations / files / links) */
.repeater { display: flex; flex-direction: column; gap: 12px; }
.repeater-row {
  display: grid; grid-template-columns: 160px 1fr 1fr auto; gap: 10px; align-items: center;
  padding: 10px; border-radius: 12px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
}
.repeater-row select, .repeater-row input {
  padding: 9px 10px; border-radius: 8px; font-size: 13px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.03); color: var(--text); font-family: inherit;
}
.repeater-row .remove {
  background: transparent; border: 0; color: var(--muted); font-size: 18px; line-height: 1;
  width: 32px; height: 32px; border-radius: 8px;
}
.repeater-row .remove:hover { background: rgba(255,80,80,.12); color: #ff8b8b; }
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
  background: rgba(var(--brand-rgb),.12); border: 1px dashed rgba(var(--brand-rgb),.5);
  color: #d6ccff; align-self: flex-start;
}
.btn-add:hover { background: rgba(var(--brand-rgb),.2); }

/* --- Project detail (founder & investor) --- */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 32px; }
.detail-hero-card {
  padding: 28px; border-radius: 22px;
  background: radial-gradient(400px 240px at 100% 0%, rgba(var(--brand-rgb),.25), transparent),
              radial-gradient(380px 200px at 0% 100%, rgba(var(--brand-2-rgb),.18), transparent),
              rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.08);
  margin-bottom: 22px;
}
.detail-hero-card .meta-row {
  display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: 13.5px;
}
.detail-hero-card .meta-row b { color: var(--text); font-weight: 600; }
.detail-section {
  padding: 24px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 18px;
}
.detail-section h3 { margin: 0 0 12px; font-size: 16px; letter-spacing: -.1px; }
.detail-section p { color: var(--muted); margin: 0 0 12px; font-size: 14.5px; line-height: 1.65; }
.artefact-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.artefact-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
  transition: border-color .15s;
}
.artefact-item:hover { border-color: rgba(var(--brand-rgb),.5); }
.artefact-item .ico {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: rgba(var(--brand-rgb),.18); border: 1px solid rgba(var(--brand-rgb),.35);
  display: grid; place-items: center; color: #d6ccff;
}
.artefact-item b { display: block; font-size: 13.5px; line-height: 1.2; }
.artefact-item span { font-size: 11.5px; color: var(--muted); }

/* Related investors / Initiate-discussion list */
.investor-row {
  display: flex; gap: 14px; align-items: center;
  padding: 14px; border-radius: 14px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 10px;
}
.investor-row .av {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 13px;
  overflow: hidden; line-height: 0;
}
.investor-row .av svg, .investor-row .av img { width: 100%; height: 100%; display: block; object-fit: cover; }
.investor-row .av.g { background: linear-gradient(135deg, #22c55e, #84cc16); }
.investor-row .av.a { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.investor-row .av.p { background: linear-gradient(135deg, var(--accent), var(--brand)); }
.investor-row .who { flex: 1; min-width: 0; }
.investor-row .who b { display: block; font-size: 14.5px; }
.investor-row .who span { font-size: 12.5px; color: var(--muted); }
.investor-row .actions { display: flex; gap: 8px; align-items: center; }
.match-pill {
  font-size: 12px; font-weight: 600; color: #b9a6ff;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(var(--brand-rgb),.12); border: 1px solid rgba(var(--brand-rgb),.35);
}

/* --- Discussion forum --- */
.disc-shell {
  display: grid; grid-template-columns: 280px 1fr 320px; gap: 18px;
  height: calc(100vh - 64px - 72px);
}
.disc-side {
  padding: 18px; border-radius: 18px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
  overflow-y: auto;
}
.disc-side h4 { margin: 0 0 12px; font-size: 13px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.disc-thread-row {
  padding: 10px; border-radius: 12px;
  border: 1px solid transparent; margin-bottom: 6px; cursor: pointer;
}
.disc-thread-row.active { background: rgba(var(--brand-rgb),.12); border-color: rgba(var(--brand-rgb),.35); }
.disc-thread-row b { display: block; font-size: 13.5px; }
.disc-thread-row span { font-size: 11.5px; color: var(--muted); }

.disc-main {
  display: grid; grid-template-rows: auto 1fr auto;
  border-radius: 18px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
  overflow: hidden;
}
.disc-head {
  padding: 16px 20px; display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.disc-head .ti { flex: 1; min-width: 0; }
.disc-head .ti b { font-size: 14.5px; }
.disc-head .ti span { display: block; color: var(--muted); font-size: 12px; }
.disc-head .status-pill {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  background: rgba(var(--brand-2-rgb),.14); border: 1px solid rgba(var(--brand-2-rgb),.4); color: #bdebff;
}
.disc-feed { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.event {
  display: flex; gap: 10px; align-items: flex-start; max-width: 78%;
}
.event.mine { align-self: flex-end; flex-direction: row-reverse; }
.event .ev-av {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #ffb057, var(--accent));
  display: grid; place-items: center; color: white; font-size: 11px; font-weight: 700;
  overflow: hidden; line-height: 0;
}
.event .ev-av svg, .event .ev-av img { width: 100%; height: 100%; display: block; object-fit: cover; }
.event.mine .ev-av { background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.event .ev-body {
  padding: 10px 14px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
  font-size: 13.5px;
}
.event.mine .ev-body { background: rgba(var(--brand-rgb),.18); border-color: rgba(var(--brand-rgb),.35); }
.event .ev-body small { display: block; margin-top: 6px; font-size: 10.5px; color: var(--muted); }
.event.system .ev-body {
  background: rgba(var(--brand-2-rgb),.08); border-color: rgba(var(--brand-2-rgb),.25);
  color: #bdebff; font-size: 12.5px;
}
.event.bid .ev-body {
  background: linear-gradient(135deg, rgba(255,184,0,.12), rgba(var(--accent-rgb),.1));
  border-color: rgba(255,184,0,.4);
}
.event.bid b.bid-amt { color: #ffd87a; }
.event.meeting .ev-body {
  background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.3);
  color: #c5f3d4;
}

.disc-compose {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.06);
  display: flex; gap: 8px; align-items: center; background: rgba(11,13,23,.5);
}
.disc-compose input {
  flex: 1; padding: 11px 14px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.disc-compose input:focus { border-color: rgba(var(--brand-rgb),.5); }
.disc-compose .icon-btn { width: 40px; height: 40px; }

.disc-aside {
  padding: 20px; border-radius: 18px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
  overflow-y: auto;
}
.disc-aside h4 { margin: 18px 0 10px; font-size: 13px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.disc-aside h4:first-child { margin-top: 0; }

/* ==========================================================================
 * 12. Discussion / messaging shell — bid leaderboard
 * ========================================================================= */

/* Bid leaderboard */
.bid-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
  margin-bottom: 6px;
}
.bid-row.lead {
  background: linear-gradient(135deg, rgba(255,184,0,.15), rgba(var(--accent-rgb),.05));
  border-color: rgba(255,184,0,.5);
}
.bid-row .rk { font-size: 12px; font-weight: 700; color: #b9a6ff; width: 22px; }
.bid-row .nm { flex: 1; font-size: 13px; }
.bid-row .nm b { display: block; }
.bid-row .nm span { color: var(--muted); font-size: 11.5px; }
.bid-row .amt { text-align: right; font-size: 13px; font-weight: 700; }
.bid-row .amt span { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }

.bid-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 12px; border-radius: 12px;
  background: rgba(var(--brand-rgb),.08); border: 1px solid rgba(var(--brand-rgb),.3);
}
.bid-form .full { grid-column: 1 / -1; }
.bid-form input, .bid-form select, .bid-form textarea {
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); color: var(--text);
  font-size: 13px; font-family: inherit;
}
.bid-form button { grid-column: 1 / -1; padding: 10px; }

/* Inline alert */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 12px; margin-bottom: 18px;
  font-size: 13.5px;
}
.alert.info { background: rgba(var(--brand-2-rgb),.07); border: 1px solid rgba(var(--brand-2-rgb),.3); color: #bdebff; }
.alert.warn { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.35); color: #ffd987; }
.alert.success { background: rgba(34,197,94,.08); border: 1px solid rgba(34,197,94,.35); color: #c5f3d4; }

/* Filter panel for browse */
.browse-grid { display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
.browse-card {
  padding: 22px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  cursor: pointer; transition: transform .2s, border-color .2s;
  display: flex; flex-direction: column; gap: 12px;
}
.browse-card:hover { transform: translateY(-2px); border-color: rgba(var(--brand-rgb),.5); }
.browse-card h3 { margin: 0; font-size: 18px; }
.browse-card .blurb { color: var(--muted); font-size: 14px; margin: 0; }
.browse-card .br-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px; border-top: 1px solid rgba(255,255,255,.06);
  font-size: 12.5px; color: var(--muted);
}
.browse-card .br-meta b { color: var(--text); }

/* Locked-view banner (investor must sign NDA before details) */
.lock-banner {
  padding: 28px; border-radius: 18px; text-align: center;
  background: radial-gradient(400px 200px at 50% 0%, rgba(var(--brand-rgb),.25), transparent),
              rgba(255,255,255,.03);
  border: 1px solid rgba(var(--brand-rgb),.4);
  margin-bottom: 22px;
}
.lock-banner .ico {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  background: rgba(var(--brand-rgb),.18); border: 1px solid rgba(var(--brand-rgb),.45);
  display: grid; place-items: center; color: #d6ccff;
}
.lock-banner h3 { margin: 0 0 6px; font-size: 19px; }
.lock-banner p { margin: 0 0 16px; color: var(--muted); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11,13,23,.7); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 520px;
  padding: 28px; border-radius: 18px;
  background: var(--surface); border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
}
.modal h3 { margin: 0 0 8px; font-size: 19px; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

/* --- Fit / match bar (red→green gradient by score) ---
   Used both as an inline indicator in match rows and as a small floating
   "fit card" on project cards. Both share the same red→green tracker. */
.fit {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  min-width: 96px;
}
.fit .fit-pct {
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 4px;
  color: var(--fit-color, #b9a6ff);
}
.fit .fit-pct b { font-weight: 800; }
.fit .fit-pct span { font-size: 10.5px; color: var(--muted); font-weight: 500; letter-spacing: .5px; text-transform: uppercase; margin-left: auto; }
.fit .fit-bar {
  width: 100%; height: 5px; border-radius: 99px;
  background: linear-gradient(90deg, #ef4444, #f59e0b 50%, #22c55e);
  position: relative; overflow: hidden;
}
.fit .fit-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: var(--fit-pct, 0%); right: 0;
  background: rgba(11,13,23,.78);
}
/* Compact card-on-card variant — tiny fit pill on a project card */
.fit.fit-mini {
  padding: 6px 10px; min-width: 0; gap: 3px;
  background: rgba(0,0,0,.25);
  border-color: rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.fit.fit-mini .fit-pct { font-size: 12px; }
.fit.fit-mini .fit-pct span { display: none; }
.fit.fit-mini .fit-bar { height: 4px; }

/* --- Project status badge (used on cards + detail) --- */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .2px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
}
.status-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 6px currentColor;
}
.status-badge.live          { background: rgba(34,197,94,.14);  border-color: rgba(34,197,94,.45);  color: #bdf3cf; }
.status-badge.live::before  { background: #22c55e; }
.status-badge.in_discussion { background: rgba(var(--brand-2-rgb),.14); border-color: rgba(var(--brand-2-rgb),.4);  color: #bdebff; }
.status-badge.in_discussion::before { background: var(--brand-2); }
.status-badge.in_diligence  { background: rgba(var(--brand-rgb),.16); border-color: rgba(var(--brand-rgb),.4);  color: #d6ccff; }
.status-badge.in_diligence::before { background: #b9a6ff; }
.status-badge.term_sheet    { background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.4);  color: #ffe1a8; }
.status-badge.term_sheet::before { background: #f59e0b; }
.status-badge.closed_won    { background: rgba(34,197,94,.18);  border-color: rgba(34,197,94,.55);  color: #bdf3cf; }
.status-badge.closed_won::before { background: #22c55e; }
.status-badge.closed_lost   { background: rgba(255,80,80,.10);  border-color: rgba(255,80,80,.35);  color: #ffb3b3; }
.status-badge.closed_lost::before { background: #ef4444; }
.status-badge.paused        { background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.3);  color: #ffd987; }
.status-badge.paused::before { background: #f59e0b; }

/* --- Profile page --- */
.profile-grid { display: grid; grid-template-columns: 320px 1fr; gap: 28px; }
.profile-side {
  position: sticky; top: 90px; align-self: start;
  padding: 24px; border-radius: 18px; text-align: center;
  background: radial-gradient(300px 200px at 50% 0%, rgba(var(--brand-rgb),.22), transparent),
              rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.08);
}
.profile-avatar-lg {
  width: 96px; height: 96px; margin: 0 auto 14px;
  border-radius: 28px;
  background: linear-gradient(135deg, #ffb057, var(--accent));
  display: grid; place-items: center; color: white; font-weight: 700; font-size: 32px;
  overflow: hidden; line-height: 0;
  border: 1px solid rgba(255,255,255,.08);
}
.profile-avatar-lg.b { background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.profile-avatar-lg svg, .profile-avatar-lg img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* ==========================================================================
 * 15. Profile pages (.profile-grid, .profile-side, .profile-meta, edit overlay)
 * ========================================================================= */

/* Edit-avatar overlay button on the large profile portrait. */
.profile-avatar-wrap { position: relative; width: 96px; margin: 0 auto 14px; }
.profile-avatar-wrap .edit-avatar {
  position: absolute; right: -4px; bottom: -4px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(var(--brand-rgb), .85);
  border: 2px solid var(--bg);
  color: white;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.profile-avatar-wrap .edit-avatar:hover { transform: scale(1.06); background: var(--brand); }

/* Sub-user pill — shown on co-founder rows to mark them as sub-profiles
   under the main account user. */
.sub-user-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(var(--brand-2-rgb), .12);
  border: 1px solid rgba(var(--brand-2-rgb), .35);
  color: var(--brand-2);
  font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase;
}
.account-user-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(var(--accent-rgb), .14);
  border: 1px solid rgba(var(--accent-rgb), .4);
  color: var(--accent);
  font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase;
}

/* --- Founder block (Project Profile, Card 2) ---
   Each founder/co-founder gets a header bar plus a grid of small "facet"
   cards (About, Skills, Education, Prior experience, …). */
.founder-block {
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 18px;
}
[data-theme="daylight"] .founder-block, [data-theme="paper"] .founder-block,
[data-theme="mint"] .founder-block, [data-theme="sky"] .founder-block {
  background: var(--surface); border-color: var(--border);
}
.founder-block .fb-head {
  display: flex; gap: 14px; align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 16px;
}
[data-theme="daylight"] .founder-block .fb-head, [data-theme="paper"] .founder-block .fb-head,
[data-theme="mint"] .founder-block .fb-head, [data-theme="sky"] .founder-block .fb-head {
  border-bottom-color: var(--border);
}
.founder-block .fb-av {
  width: 64px; height: 64px; border-radius: 18px;
  overflow: hidden; flex-shrink: 0;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.founder-block .fb-av svg, .founder-block .fb-av img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* Inside an editable founder-block (.subprofile-card or main edit form),
   the avatar gets a click affordance: cursor pointer + hover overlay
   labelled "Edit photo" so users know to click it. */
.subprofile-card .fb-av,
.founder-block .fb-av[id="form-main-avatar"] {
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.subprofile-card .fb-av:hover,
.founder-block .fb-av[id="form-main-avatar"]:hover {
  border-color: rgba(var(--brand-rgb), .55);
  transform: scale(1.03);
}
.fb-av-edit-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(0,0,0,.55);
  color: white;
  font-size: 11px; font-weight: 600;
  letter-spacing: .3px;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.subprofile-card .fb-av:hover .fb-av-edit-overlay,
.founder-block .fb-av[id="form-main-avatar"]:hover .fb-av-edit-overlay,
.cof-photo-trigger:hover .fb-av-edit-overlay {
  opacity: 1;
}
.cof-photo-trigger { transition: transform .15s; }
.cof-photo-trigger:hover { transform: scale(1.06); }
.founder-block .fb-meta { flex: 1; min-width: 0; }
/* Chevron toggle on the right of each fb-head — collapses the facet grid */
.founder-block .fb-arrow {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0;
  color: var(--muted);
  transition: transform .2s, background .2s, color .15s;
}
.founder-block .fb-arrow:hover {
  background: rgba(var(--brand-rgb), .14);
  border-color: rgba(var(--brand-rgb), .35);
  color: var(--text);
}
.founder-block.collapsed .fb-arrow { transform: rotate(-90deg); }
.founder-block.collapsed .facet-grid { display: none; }
.founder-block.collapsed .fb-head {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom-color: transparent;
}
[data-theme="daylight"] .founder-block .fb-arrow,
[data-theme="paper"]    .founder-block .fb-arrow,
[data-theme="mint"]     .founder-block .fb-arrow,
[data-theme="sky"]      .founder-block .fb-arrow {
  background: var(--surface-2);
  border-color: var(--border);
}
.founder-block .fb-meta h4 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.2px; }
.founder-block .fb-meta .role { color: var(--muted); font-size: 13px; }
.founder-block .fb-meta .badges { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.founder-block .fb-meta .links {
  margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px;
}
.founder-block .fb-meta .links a { color: var(--brand); }

.facet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.facet-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.06);
}
[data-theme="daylight"] .facet-card, [data-theme="paper"] .facet-card,
[data-theme="mint"] .facet-card, [data-theme="sky"] .facet-card {
  background: var(--surface-2); border-color: var(--border);
}
.facet-card.full { grid-column: 1 / -1; }
.facet-card h5 {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--brand);
}
.facet-card p { margin: 0; font-size: 13.5px; color: var(--text); line-height: 1.6; }
.facet-card ul { padding-left: 16px; margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.facet-card .empty { color: var(--muted); font-size: 12.5px; font-style: italic; }
.facet-card .tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 720px) {
  .facet-grid { grid-template-columns: 1fr; }
}

/* --- Sub-profile credentials block (Account Profile) --- */
.creds-row {
  display: grid;
  grid-template-columns: 220px 1fr 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.06);
  margin-top: 8px;
  font-size: 13px;
  align-items: center;
}
/* Merged variant — wider grid with status + Save + (optional View-as) + Edit */
.creds-row.creds-row-merged {
  grid-template-columns: 220px 1fr 1fr auto auto;
}

/* --- Activity feed (account profile) --- */
.activity-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 480px; overflow-y: auto;
  padding-right: 4px;
}
.activity-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(255, 255, 255, .04);
  font-size: 13px;
}
.activity-row .ico {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(var(--brand-rgb), .12);
  color: var(--brand);
  font-size: 13px;
}
.activity-row .label { color: var(--text); font-weight: 500; }
.activity-row .meta  { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.activity-row .when  {
  color: var(--muted); font-size: 11.5px;
  white-space: nowrap;
}
.activity-empty {
  padding: 22px; text-align: center;
  color: var(--muted); font-size: 13px;
  border: 1px dashed rgba(255, 255, 255, .08);
  border-radius: 10px;
}
.activity-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.activity-summary .stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.activity-summary .stat b { display: block; font-size: 20px; color: var(--brand); }
.activity-summary .stat span { color: var(--muted); font-size: 11px; }
.cred-edit-link {
  text-decoration: none;
  display: inline-flex; align-items: center;
  background: rgba(var(--brand-rgb), .14);
  border: 1px solid rgba(var(--brand-rgb), .35);
  color: var(--brand) !important;
  padding: 6px 10px; border-radius: 8px;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
}
.cred-edit-link:hover { background: rgba(var(--brand-rgb), .22); }
[data-theme="daylight"] .creds-row, [data-theme="paper"] .creds-row,
[data-theme="mint"] .creds-row, [data-theme="sky"] .creds-row {
  background: var(--surface-2); border-color: var(--border);
}
.creds-row .who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.creds-row .who span.pf-av { width: 32px; height: 32px; }
.creds-row .who b { display: block; font-size: 13px; }
.creds-row .who small { color: var(--muted); font-size: 11px; display: block; }
.creds-row input {
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04); color: var(--text); font-family: inherit;
}
.creds-row .actions { display: flex; gap: 6px; }
.creds-row .pill {
  padding: 6px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
  background: rgba(var(--brand-rgb), .14);
  border: 1px solid rgba(var(--brand-rgb), .35);
  color: var(--brand); cursor: pointer;
}
.creds-row .pill:hover { background: rgba(var(--brand-rgb), .22); }
.creds-row .stat {
  font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
  background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4);
  color: #bdf3cf;
}
.creds-row .stat.unset {
  background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.4); color: #ffd987;
}
@media (max-width: 720px) {
  .creds-row, .creds-row.creds-row-merged { grid-template-columns: 1fr; }
}

/* ==========================================================================
 * 18. Sub-profile cards (single co-founder block in the rich repeater)
 * ========================================================================= */

/* Sub-profile card — single co-founder block in the rich repeater. */
.subprofile-card {
  padding: 18px;
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 12px;
}
.subprofile-card .sp-head {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 14px;
}
.subprofile-card .sp-head .sp-av {
  width: 56px; height: 56px; border-radius: 14px;
  background: rgba(255,255,255,.04);
  overflow: hidden; cursor: pointer; flex-shrink: 0;
  position: relative;
}
.subprofile-card .sp-head .sp-av svg, .subprofile-card .sp-head .sp-av img {
  width: 100%; height: 100%; display: block; object-fit: cover;
}
.subprofile-card .sp-head .sp-av:hover::after {
  content: "Edit"; position: absolute; inset: 0;
  background: rgba(0,0,0,.55); color: white;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.subprofile-card .sp-head .sp-meta {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.subprofile-card .sp-head .sp-meta .name {
  font-size: 14.5px; font-weight: 700;
}
.subprofile-card .sp-head .sp-actions { display: flex; gap: 6px; }
.subprofile-card .sp-head .sp-actions .icon-btn {
  width: 32px; height: 32px;
}
.subprofile-card .sp-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.subprofile-card .sp-grid .field { margin-bottom: 0; }
.subprofile-card .sp-grid .field.full { grid-column: 1 / -1; }
.subprofile-card .sp-grid .field label {
  font-size: 10.5px; color: var(--muted); letter-spacing: .5px;
  text-transform: uppercase; margin-bottom: 4px;
}
.subprofile-card .sp-grid .field input,
.subprofile-card .sp-grid .field textarea {
  padding: 9px 10px; border-radius: 8px; font-size: 13px;
}
.profile-side h2 { margin: 0 0 4px; font-size: 22px; }
.profile-side .role-tag {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: rgba(var(--brand-rgb),.18); border: 1px solid rgba(var(--brand-rgb),.4);
  color: #d6ccff; font-size: 11.5px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; margin: 6px 0 12px;
}
.profile-side p.tagline { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
.profile-meta {
  text-align: left; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.profile-meta a { color: #b9a6ff; }
.profile-meta .row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.profile-meta .row svg { color: var(--muted); flex-shrink: 0; }
.profile-meta .row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin: 16px 0 4px;
}
.profile-stats .ps {
  padding: 10px 6px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
}
.profile-stats b { display: block; font-size: 18px; }
.profile-stats span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

.profile-section {
  padding: 22px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 16px;
}
.profile-section h3 {
  margin: 0 0 4px; font-size: 15px; letter-spacing: -.1px;
}
.profile-section .sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.profile-list { display: flex; flex-direction: column; gap: 10px; }
.profile-list .pl-row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.06);
  font-size: 13.5px;
}
.profile-list .pl-row .ico {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  background: rgba(var(--brand-rgb),.16); border: 1px solid rgba(var(--brand-rgb),.35);
  display: grid; place-items: center; color: #d6ccff;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Round repeater (rich, multi-row) --- */
.round-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto; gap: 8px; align-items: center;
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
}
.round-row input, .round-row select {
  padding: 9px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.03); color: var(--text);
  font-size: 13px; font-family: inherit;
}
.round-row .remove {
  background: transparent; border: 0; color: var(--muted); font-size: 18px;
  width: 32px; height: 32px; border-radius: 8px;
}
.round-row .remove:hover { background: rgba(255,80,80,.12); color: #ff8b8b; }
.round-row label {
  font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
  display: block; margin-bottom: 3px;
}

/* --- External-pipeline rows --- */
.pipeline-row {
  display: grid; grid-template-columns: 1.5fr 1fr 1.4fr 1fr auto; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07);
  margin-bottom: 8px; font-size: 13px;
}
.pipeline-row b { display: block; font-size: 14px; }
.pipeline-row .src {
  display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: var(--muted);
  margin-top: 4px; letter-spacing: .3px; text-transform: uppercase;
}
.pipeline-row .src.ext { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); color: #ffd987; }
.pipeline-row .src.pf  { background: rgba(var(--brand-rgb),.14); border-color: rgba(var(--brand-rgb),.4); color: #d6ccff; }
.pipeline-row .prop { color: var(--muted); }
.pipeline-row .stat {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: rgba(var(--brand-2-rgb),.12); border: 1px solid rgba(var(--brand-2-rgb),.35); color: #bdebff;
  white-space: nowrap;
}
.pipeline-row .stat.passed { background: rgba(255,80,80,.1); border-color: rgba(255,80,80,.35); color: #ffb3b3; }
.pipeline-row .stat.committed, .pipeline-row .stat.in_diligence {
  background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: #bdf3cf;
}
.pipeline-add {
  display: grid; grid-template-columns: 1.4fr 1fr 1.4fr 1fr 1fr auto; gap: 8px; align-items: end;
  padding: 14px; border-radius: 12px;
  background: rgba(var(--brand-rgb),.07); border: 1px dashed rgba(var(--brand-rgb),.4);
  margin-top: 12px;
}
.pipeline-add input, .pipeline-add select {
  padding: 9px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.03); color: var(--text);
  font-size: 13px; font-family: inherit;
}

/* --- Calendly + email action strip in discussion --- */
.disc-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.disc-actions .btn { padding: 8px 12px; font-size: 13px; width: auto; }

/* ==========================================================================
 * 20. Responsive @media rules
 * ========================================================================= */
@media (max-width: 1024px) {
  .form-wrap, .nda-wrap, .detail-grid, .browse-grid, .profile-grid { grid-template-columns: 1fr; }
  .disc-shell { grid-template-columns: 1fr; height: auto; }
  .disc-side, .disc-aside { display: none; }
  .round-row { grid-template-columns: 1fr 1fr; }
  .pipeline-row, .pipeline-add { grid-template-columns: 1fr 1fr; }
  .profile-side { position: static; }
}
@media (max-width: 720px) {
  .portal-tabs { display: none; }
  .repeater-row { grid-template-columns: 1fr; }
}


/* ==========================================================================
 * 21. Mobile-first refinements + Capacitor / PWA support
 * --------------------------------------------------------------------------
 * Added 2026-05-07 alongside the PWA manifest and Capacitor app wrap.
 * Companion section to "20. Mobile-first refinements" in styles.css. The
 * portal pages have a different layout (sidebar/topbar + page-head + grids
 * for project lists, profile cards, discussion threads) so they need their
 * own pass — the rules in styles.css don't cover .portal-shell / .browse-grid /
 * .disc-shell / .pipeline-row, etc.
 *
 * Why these patches
 * -----------------
 *   - The portal currently goes single-column at ≤ 1024 px (tablet+) but
 *     between 600 and 1024 the cards get awkwardly wide; we dial padding
 *     down so portrait tablets feel right.
 *   - Discussion shell hides side rails at 1024 — fine — but the message
 *     composer needs full-width treatment plus a sticky bottom bar.
 *   - The portal nav (.portal-bar) is a second top bar on top of the .nav;
 *     it eats vertical space on phones, so we collapse it to a single row.
 *   - .pipeline-row + .round-row become 1-col earlier so cards don't
 *     squeeze numeric columns into illegible widths.
 *
 * Breakpoints used here
 * ---------------------
 *   ≤ 768px  → tablets / large phones
 *   ≤ 600px  → phones (matches styles.css phone breakpoint)
 * ========================================================================= */


/* ============================================================
 * 21a. Capacitor / PWA safe-area for the portal shell
 * ============================================================ */
@media (display-mode: standalone) {
  .portal-bar-inner,
  .portal-subnav-row {
    padding-left:  max(22px, env(safe-area-inset-left));
    padding-right: max(22px, env(safe-area-inset-right));
  }
}

body.platform-capacitor .portal-bar { padding-top: env(safe-area-inset-top); }
body.platform-capacitor .portal-bar-inner,
body.platform-capacitor .portal-subnav-row {
  padding-left:  max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
}


/* ============================================================
 * 21b. Tablet breakpoint (≤ 768px) — large phones + iPad portrait
 * ============================================================ */
@media (max-width: 768px) {
  /* Portal top bar — keep brand + avatar visible, drop the secondary nav */
  .portal-tabs                   { display: none; }
  .portal-subnav-links           { gap: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .portal-subnav-links a         { white-space: nowrap; padding-block: 10px; }

  /* Common card grids — collapse to 1-col earlier than the 1024 default,
     so single cards aren't 700-px wide ribbons of whitespace. */
  .pipeline-row,
  .pipeline-add,
  .round-row { grid-template-columns: 1fr; gap: 12px; }

  /* Discussion compose row + thread bubble widths */
  .disc-actions { gap: 6px; }
  .disc-actions .btn { padding: 9px 12px; font-size: 13px; min-height: 40px; }

  /* Page-head padding tighter on phones */
  .page-head { padding: 16px 0; }
}


/* ============================================================
 * 21c. Phone breakpoint (≤ 600px)
 * ============================================================ */
@media (max-width: 600px) {
  /* Tighter portal container padding to match marketing styles.css */
  .portal-bar-inner    { padding: 10px 16px; }
  .portal-subnav-row   { padding: 0 16px; }
  .portal-shell main   { padding: 16px; }

  /* Forms: bump fields to 16px and add breathing room.
     Same rationale as in styles.css 20c — iOS auto-zooms < 16px inputs. */
  .field input,
  .field select,
  .field textarea,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  textarea, select  { font-size: 16px; }

  /* Buttons — meet 44 px touch target (matches styles.css). */
  .btn { min-height: 44px; }

  /* Stack the user popover cleanly */
  .nav-cta .user-popover { right: 0; left: auto; min-width: 240px; }

  /* Founder / investor profile + project pages — avoid edge-to-edge
     tap targets that overlap the system gesture areas on Android. */
  .browse-grid,
  .detail-grid,
  .profile-grid,
  .form-wrap,
  .nda-wrap         { gap: 14px; }

  /* Long-form readable widths — keep article body inside the safe area */
  .article          { padding-left: 4px; padding-right: 4px; }

  /* Repeater rows (line items in founder forms) */
  .repeater-row     { gap: 10px; }
}


/* ============================================================
 * 21d. Tiny-phone breakpoint (≤ 380px)
 * ============================================================ */
@media (max-width: 380px) {
  .portal-bar-inner .brand { font-size: 14px; }
  .portal-shell main       { padding: 12px; }
  .nav-cta .portal-user .who { display: none; }
  .btn { padding: 11px 14px; font-size: 14px; }
}
