/* ========================================
   PORTAL DESIGN SYSTEM
   Matches raspberry.ventures main site
   Fraunces (display) + Plus Jakarta Sans (body)
   ======================================== */

:root {
  --raspberry: #C2185B;
  --raspberry-light: #E91E6C;
  --raspberry-subtle: #FDF0F4;
  --cream: #FAF8F5;
  --cream-dark: #F2EDE8;
  --ink: #1A1A1A;
  --ink-secondary: #5A5A5A;
  --ink-tertiary: #8A8A8A;
  --border: #E8E4DF;
  --border-subtle: #F0ECE7;
  --white: #FFFFFF;
  --blue: #1565C0;
  --blue-bg: #E3F2FD;
  --green: #2E7D32;
  --green-bg: #E8F5E9;
  --purple: #7B1FA2;
  --purple-bg: #F3E5F5;
  --red: #C62828;
  --red-bg: #FFEBEE;
  --amber: #E65100;
  --amber-bg: #FFF3E0;
  --font-display: 'Fraunces', serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --radius: 12px;
  --radius-pill: 100px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
  --nav-height: 64px;
  --max-width: 1120px;
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ========== LAYOUT ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== NAV ========== */
.portal-nav {
  position: sticky;
  top: 0;
  height: var(--nav-height);
  background: var(--cream);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.portal-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-brand .nav-face {
  height: 36px;
  width: auto;
}

.nav-brand .dot {
  color: var(--raspberry);
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.nav-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-tertiary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--cream-dark);
}

.nav-links a.active {
  color: var(--raspberry);
  background: var(--raspberry-subtle);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.btn-signout {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-tertiary);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: all var(--transition);
}

.btn-signout:hover {
  color: var(--raspberry);
  border-color: var(--raspberry);
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--raspberry);
  color: white;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
  border: none;
}

.btn-primary:hover {
  background: var(--raspberry-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-outline:hover {
  border-color: var(--raspberry);
  color: var(--raspberry);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-secondary);
  transition: color var(--transition);
  margin-bottom: 24px;
}

.btn-back:hover { color: var(--raspberry); }

/* ========== PAGE LAYOUT ========== */
.page-content {
  padding: 40px 0 80px;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--ink-secondary);
  font-size: 0.95rem;
}

/* ========== SUMMARY CARDS ========== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow-sm);
}

.summary-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-tertiary);
  margin-bottom: 6px;
}

.summary-card .value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.summary-card .value.positive { color: var(--green); }
.summary-card .value.negative { color: var(--red); }

.summary-card .sub {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
  margin-top: 2px;
}

/* ========== CURRENCY BADGE ========== */
.currency-note {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
  margin-bottom: 24px;
  font-style: italic;
}

/* ========== POSITIONS TABLE ========== */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.table-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.table-header .count {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
  background: var(--cream);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.positions-table {
  font-size: 0.9rem;
}

.positions-table thead {
  background: var(--cream);
}

.positions-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-tertiary);
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
}

.positions-table th.num {
  text-align: right;
}

.positions-table td {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.positions-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.positions-table tbody tr {
  transition: background var(--transition);
}

.positions-table tbody tr:hover {
  background: var(--cream);
}

.positions-table tbody tr.clickable {
  cursor: pointer;
}

.company-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.company-cell .name {
  font-weight: 600;
  color: var(--ink);
}

.company-cell .desc {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-climate { background: var(--green-bg); color: var(--green); }
.badge-ai { background: #E3F2FD; color: #1565C0; }
.badge-ecosystem { background: var(--amber-bg); color: var(--amber); }

.badge-equity { background: #E8F5E9; color: #2E7D32; }
.badge-convertible { background: #FFF3E0; color: #E65100; }
.badge-syndicate { background: #E3F2FD; color: #1565C0; }
.badge-token { background: #F3E5F5; color: #7B1FA2; }

.multiple {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.multiple.up { color: var(--green); }
.multiple.down { color: var(--red); }
.multiple.flat { color: var(--ink-tertiary); }

/* ========== COMPANY DETAIL ========== */
.company-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  gap: 24px;
}

.company-header .meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 0.8rem;
  color: var(--ink-secondary);
  background: var(--cream-dark);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.company-header .website-link {
  font-size: 0.85rem;
  color: var(--raspberry);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.company-header .website-link:hover {
  text-decoration: underline;
}

/* ========== DEAL CARDS ========== */
.deals-section, .diary-section {
  margin-bottom: 40px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.deal-card {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.deal-card .deal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.deal-card .deal-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.deal-card .deal-date {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
}

.deal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.deal-stat .label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-tertiary);
  margin-bottom: 2px;
}

.deal-stat .val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ========== DIARY ENTRIES ========== */
.diary-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}

.diary-entry {
  background: var(--white);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 90px 80px 1fr;
  gap: 16px;
  align-items: start;
}

.diary-entry .date {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.diary-entry .type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
  align-self: start;
}

.type-update { background: #E3F2FD; color: #1565C0; }
.type-funding { background: var(--green-bg); color: var(--green); }
.type-closed_round { background: #F3E5F5; color: #7B1FA2; }
.type-warning { background: var(--red-bg); color: var(--red); }

.diary-entry .summary {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.5;
}

/* ========== SYNDICATE LEAD EXTRAS ========== */
.lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--raspberry);
  background: var(--raspberry-subtle);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-secondary);
  border: 1px solid var(--border);
  background: var(--white);
  transition: all var(--transition);
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--raspberry);
  color: var(--raspberry);
}

.filter-btn.active {
  background: var(--raspberry);
  color: white;
  border-color: var(--raspberry);
}

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.login-card .brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-card .brand .brand-face {
  height: 42px;
  width: auto;
}

.login-card .brand .dot { color: var(--raspberry); }

.login-card .subtitle {
  font-size: 0.85rem;
  color: var(--ink-tertiary);
  margin-bottom: 32px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-card .desc {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  transition: border-color var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--raspberry);
  background: var(--white);
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 0.9rem;
}

.login-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
  line-height: 1.4;
}

.login-message.success {
  display: block;
  background: var(--green-bg);
  color: var(--green);
}

.login-message.error {
  display: block;
  background: var(--red-bg);
  color: var(--red);
}

.login-footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--ink-tertiary);
}

.login-footer a {
  color: var(--raspberry);
  font-weight: 500;
}

/* ========== LOADING / EMPTY STATES ========== */
.loading {
  text-align: center;
  padding: 80px 24px;
  color: var(--ink-tertiary);
  font-size: 0.9rem;
}

.loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--raspberry);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-tertiary);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 8px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .positions-table {
    min-width: 700px;
  }

  .company-header {
    flex-direction: column;
  }

  .diary-entry {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .diary-entry .date,
  .diary-entry .type {
    display: inline-block;
  }

  .nav-links { display: none; }

  .page-header h1 {
    font-size: 1.4rem;
  }

  .deal-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .nav-user { display: none; }
}

/* ========== PORTAL DISCLAIMER FOOTER ========== */

.portal-footer {
  margin-top: 64px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.portal-footer .container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.portal-footer-text {
  font-size: 0.8rem;
  color: var(--ink-tertiary);
  line-height: 1.6;
  max-width: 720px;
}

.portal-footer-text a {
  color: var(--ink-secondary);
  text-decoration: underline;
}

/* ========== SPIN-OUT DISPLAY ========== */
.combined-multiple {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-tertiary);
  font-weight: 500;
  margin-top: 2px;
}
.spinout-note {
  font-size: 0.75rem;
  color: var(--ink-tertiary);
  font-weight: 400;
}
.position-count {
  font-size: 0.7rem;
  color: var(--ink-tertiary);
  font-weight: 500;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
}
.sub-row td {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  background: var(--surface);
  border-top: none !important;
  font-size: 0.82rem;
}
.sub-row:last-child td,
.sub-row + tr:not(.sub-row) td {
  border-top: 1px solid var(--border) !important;
}
.sub-deal-name {
  padding-left: 24px;
  color: var(--ink-secondary);
  font-size: 0.8rem;
}

/* ========== VIEW TABS ========== */
.view-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.view-tab {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--ink-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.view-tab:hover {
  color: var(--ink);
}
.view-tab.active {
  color: var(--raspberry);
  border-bottom-color: var(--raspberry);
  font-weight: 600;
}
.carry-explainer {
  color: var(--ink-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--cream-dark);
  border-radius: 8px;
}
