/* Anti Fund Growth I — LP Scenario Model */
/* Brand Colors */
:root {
  --navy: #1a1a2e;
  --green: #00c896;
  --green-light: #00c89620;
  --green-mid: #00c89640;
  --light: #f4f6fb;
  --light2: #e8ecf4;
  --grey: #6b7280;
  --dkgrey: #374151;
  --red: #ef4444;
  --red-light: #ef444420;
  --white: #ffffff;
  --font-display: 'Noto Serif', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(26,26,46,0.06);
  --shadow-md: 0 4px 12px rgba(26,26,46,0.08);
  --shadow-lg: 0 8px 24px rgba(26,26,46,0.10);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--light);
  color: var(--dkgrey);
  line-height: 1.55;
  min-height: 100dvh;
}

/* Typography */
h1, h2, h3 { font-family: var(--font-display); color: var(--navy); font-weight: 700; }
h1 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); line-height: 1.2; }
h2 { font-size: clamp(1.1rem, 2vw, 1.35rem); }
h3 { font-size: 0.95rem; font-weight: 600; }

/* Tabular numbers for all data */
.kpi-value, .positions-table, .scenario-table, .slider-value,
td, th { font-variant-numeric: tabular-nums lining-nums; }

/* ===== HEADER ===== */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--light2);
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo { height: 36px; width: auto; }
.header-text { display: flex; flex-direction: column; gap: 2px; }
.subtitle { font-size: 0.85rem; color: var(--grey); }

/* ===== MAIN ===== */
.main { max-width: 1400px; margin: 0 auto; padding: 24px 32px 48px; }

/* ===== SECTIONS ===== */
.section { margin-bottom: 40px; }
.section-title {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--navy);
  display: inline-block;
}
.section-desc { font-size: 0.875rem; color: var(--grey); margin-bottom: 16px; }

/* ===== KPI CARDS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--grey);
}
.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--navy);
}
.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }

/* ===== SLIDERS ===== */
.sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider-label {
  min-width: 110px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dkgrey);
  display: flex;
  align-items: center;
  gap: 8px;
}
.scenario-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.scenario-dot.cat { background: var(--red); }
.scenario-dot.bear { background: #f59e0b; }
.scenario-dot.base { background: var(--green); }
.scenario-dot.bull { background: #3b82f6; }

.slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--light2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--navy);
  cursor: grab;
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--navy);
  cursor: grab;
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.slider-value {
  min-width: 40px;
  text-align: right;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
}

/* ===== TABS ===== */
.horizon-tabs { display: flex; gap: 0; margin-bottom: 16px; }
.tab-btn, .tab-btn-detail, .chart-tab {
  padding: 8px 20px;
  border: 1px solid var(--light2);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--grey);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab-btn:first-child, .tab-btn-detail:first-child, .chart-tab:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}
.tab-btn:last-child, .tab-btn-detail:last-child, .chart-tab:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}
.tab-btn.active, .tab-btn-detail.active, .chart-tab.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* ===== TABLES ===== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.positions-table, .scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  white-space: nowrap;
}
.positions-table thead, .scenario-table thead {
  background: var(--navy);
  color: var(--white);
}
.positions-table th, .scenario-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.positions-table td, .scenario-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--light2);
}
.positions-table tbody tr:hover, .scenario-table tbody tr:hover {
  background: var(--light);
}
.col-num { text-align: right; }
.col-exit { text-align: center; }
.col-pw { background: rgba(0, 200, 150, 0.08); }

/* Metric label in scenario table */
.scenario-table td:first-child {
  font-weight: 600;
  color: var(--navy);
}

/* Position type badge */
.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.type-badge.warehoused { background: var(--light2); color: var(--grey); }
.type-badge.new { background: var(--green-light); color: #059669; }

/* Exit val inputs */
.exit-input {
  width: 68px;
  padding: 4px 6px;
  border: 1px solid var(--light2);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: var(--light);
  transition: border-color 0.15s ease;
}
.exit-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-light);
}
.exit-input:hover { border-color: var(--grey); }

/* MOIC cell coloring */
.moic-positive { color: var(--green); font-weight: 600; }
.moic-negative { color: var(--red); font-weight: 600; }

/* ===== CHARTS ===== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.chart-card {
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.chart-card-wide { grid-column: 1 / -1; }
.chart-title {
  font-size: 0.85rem;
  color: var(--navy);
  margin-bottom: 12px;
}
.chart-horizon-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
}
.chart-container { position: relative; width: 100%; height: 320px; }
.chart-container-tall { height: 480px; }

/* ===== NOTES ===== */
.notes-group {
  margin-bottom: 20px;
}
.notes-group:last-child {
  margin-bottom: 0;
}
.notes-heading {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.notes-list {
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 24px 24px 24px 40px;
  box-shadow: var(--shadow-sm);
  list-style: disc;
}
.notes-list li {
  font-size: 0.85rem;
  color: var(--dkgrey);
  padding: 4px 0;
}
.notes-list .disclaimer {
  font-style: italic;
  color: var(--grey);
  margin-top: 8px;
  border-top: 1px solid var(--light2);
  padding-top: 12px;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--navy);
  padding: 32px;
  text-align: center;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.footer-logo { height: 28px; width: auto; opacity: 0.9; }
.footer-text { color: rgba(255,255,255,0.6); font-size: 0.8rem; }
.footer-link {
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-link:hover { color: var(--green); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card-wide { grid-column: 1; }
}
@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .main { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-value { font-size: 1.25rem; }
  .sliders-grid { grid-template-columns: 1fr; padding: 16px; }
  .section-title { font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { padding: 14px; }
}

/* Scenario table coloring */
.scenario-table .pw-col { background: rgba(0, 200, 150, 0.06); font-weight: 600; }

/* ===== COMPANY DETAIL PAGE ===== */
.company-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 48px;
}
.company-page-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 24px;
  align-self: flex-start;
}
.back-btn:hover {
  background: #2a2a4e;
  box-shadow: var(--shadow-md);
}
.back-btn svg { flex-shrink: 0; }

/* Company Page Header */
.cp-header {
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}
.cp-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.cp-company-name {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  margin: 0;
}
.cp-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cp-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cp-badge.warehoused { background: var(--light2); color: var(--grey); }
.cp-badge.new { background: var(--green-light); color: #059669; }
.cp-header-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--grey);
}
.cp-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cp-meta-label {
  font-weight: 600;
  color: var(--dkgrey);
}
.cp-meta-value {
  color: var(--navy);
  font-weight: 700;
  font-family: var(--font-display);
}

/* Company Overview */
.cp-overview {
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--dkgrey);
}
.cp-overview p {
  margin-bottom: 14px;
}
.cp-overview p:last-child {
  margin-bottom: 0;
}
.cp-overview .cp-sector-tag {
  display: inline-block;
  background: var(--light2);
  color: var(--navy);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

/* Company Sections */
.cp-section {
  margin-bottom: 32px;
}

/* Charts Row */
.cp-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* Revenue Table */
.cp-revenue-table th,
.cp-revenue-table td {
  text-align: right;
  padding: 8px 10px;
}
.cp-revenue-table th:first-child,
.cp-revenue-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--navy);
}
.cp-revenue-table .editable-cell {
  background: var(--light);
}
.cp-revenue-input {
  width: 72px;
  padding: 4px 6px;
  border: 1px solid var(--light2);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: var(--light);
  transition: border-color 0.15s ease;
}
.cp-revenue-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-light);
}
.cp-revenue-input:hover { border-color: var(--grey); }

/* Scenario tables */
.cp-scenario-horizons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.cp-scenario-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cp-scenario-table td.scenario-label {
  font-weight: 600;
  text-transform: capitalize;
}
.cp-scenario-table .cp-total-row {
  background: var(--light);
  font-weight: 700;
}
.cp-scenario-table .cp-total-row td {
  border-top: 2px solid var(--navy);
}

/* Valuation Bridge */
.cp-bridge {
  background: var(--white);
  border: 1px solid var(--light2);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}
.cp-bridge-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 16px;
}
.cp-bridge-row:last-child {
  margin-bottom: 0;
}
.cp-bridge-label {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dkgrey);
}
.cp-bridge-bar-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 36px;
}
.cp-bridge-bar {
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--white);
  transition: width 0.3s ease;
  min-width: 60px;
}
.cp-bridge-bar.entry { background: var(--grey); }
.cp-bridge-bar.current { background: var(--navy); }
.cp-bridge-bar.exit { background: var(--green); }
.cp-bridge-bar.exit-neg { background: var(--red); }

/* Company name links in positions table */
.company-link {
  color: var(--navy);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.15s ease;
  border-bottom: 1px solid transparent;
}
.company-link:hover {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* ===== COMPANY PAGE RESPONSIVE ===== */
@media (max-width: 1024px) {
  .cp-charts-row { grid-template-columns: 1fr; }
  .cp-scenario-horizons { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .company-page { padding: 16px; }
  .cp-header { padding: 20px; }
  .cp-company-name { font-size: 1.35rem; }
  .cp-header-meta { gap: 12px; }
  .cp-bridge-label { width: 120px; font-size: 0.75rem; }
}
