/* Portfolio Lab — direct port of v0 factsheet design */

:root {
  /* exact oklch tokens from v0 */
  --background: oklch(0.97 0.005 90);
  --foreground: oklch(0.2 0.02 160);
  --card: oklch(0.99 0.002 90);
  --primary: oklch(0.35 0.1 160);
  --primary-foreground: oklch(0.98 0.005 90);
  --secondary: oklch(0.94 0.01 90);
  --muted: oklch(0.92 0.008 90);
  --muted-foreground: oklch(0.5 0.02 160);
  --accent: oklch(0.35 0.1 160);
  --destructive: oklch(0.55 0.2 25);
  --destructive-foreground: oklch(0.98 0.005 90);
  --border: oklch(0.88 0.01 90);
  --radius: 0.5rem;

  /* alpha-blended monthly cell colours */
  --primary-soft30: color-mix(in oklch, var(--primary) 30%, transparent);
  --primary-soft70: color-mix(in oklch, var(--primary) 70%, transparent);
  --destructive-soft20: color-mix(in oklch, var(--destructive) 20%, transparent);
  --destructive-soft40: color-mix(in oklch, var(--destructive) 40%, transparent);
  --muted-soft30: color-mix(in oklch, var(--muted) 60%, transparent);

  /* chart palette */
  --chart-1: oklch(0.35 0.1 160);
  --chart-2: oklch(0.45 0.09 160);
  --chart-3: oklch(0.55 0.08 160);
  --chart-4: oklch(0.65 0.06 160);
  --chart-5: oklch(0.72 0.05 160);
  --chart-6: oklch(0.78 0.04 160);
  --chart-7: oklch(0.85 0.02 160);

  --warn: oklch(0.55 0.12 70);
  --warn-bg: oklch(0.95 0.05 90);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: opacity .12s; }
a:hover { opacity: 0.8; }
code {
  font-family: "JetBrains Mono", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
h1, h2, h3 { font-weight: 600; color: var(--foreground); letter-spacing: -0.3px; margin: 0; }
.tabular { font-variant-numeric: tabular-nums; }

/* === BANNER + NAV === */
.disclaimer-banner {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 7px 24px;
  font-size: 11.5px;
  text-align: center;
  font-weight: 500;
}
.disclaimer-banner strong { font-weight: 700; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 36px;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground);
  letter-spacing: -0.4px;
  display: flex; align-items: center; gap: 9px;
}
.brand::before {
  content: ""; width: 22px; height: 22px;
  background: var(--primary);
  border-radius: 6px;
}
.brand:hover { opacity: 1; color: var(--foreground); }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a {
  font-size: 13.5px; color: var(--muted-foreground); font-weight: 500;
  padding: 7px 14px; border-radius: 6px;
}
.topbar nav a:hover { background: var(--muted); color: var(--foreground); opacity: 1; }

main { padding: 0; max-width: none; margin: 0; }
footer {
  padding: 32px 0 48px;
  color: var(--muted-foreground);
  font-size: 11.5px;
  max-width: 80rem;
  margin: 64px auto 0;
  border-top: 1px solid var(--border);
  padding-left: 24px; padding-right: 24px;
}
footer p { margin: 0 0 8px; line-height: 1.55; max-width: 42rem; }
footer h4 {
  margin: 0 0 8px; color: var(--foreground); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700;
}
footer .footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }

/* === LANDING === */
.hero { padding: 64px 24px 48px; max-width: 80rem; margin: 0 auto; }
.hero .eyebrow {
  display: inline-block;
  color: var(--muted-foreground);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero h1 { font-size: 44px; line-height: 1.1; margin: 0 0 18px; letter-spacing: -1.2px; font-weight: 600; }
.hero .lede { color: var(--muted-foreground); font-size: 17px; margin: 0; line-height: 1.55; max-width: 720px; }

.product-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px;
  padding: 0 24px;  max-width: 80rem; margin: 0 auto 64px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  display: flex; flex-direction: column;
  color: var(--foreground);
  transition: border-color .15s, transform .15s;
  min-height: 200px;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; opacity: 1; }
.product-card .card-tag {
  display: inline-block; align-self: flex-start;
  background: var(--muted); color: var(--primary);
  font-size: 10.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: 0.6px; text-transform: uppercase;
}
.product-card h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.3px; margin-bottom: 8px; }
.product-card p { color: var(--muted-foreground); margin: 0 0 auto; font-size: 13.5px; }
.card-cta { color: var(--primary); margin-top: 18px; font-weight: 600; font-size: 13.5px; }

.how { padding: 0 24px; margin: 0 auto 64px; max-width: 80rem; }
.how h2 { font-size: 22px; margin-bottom: 20px; }
.how-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.how-grid > div {
  padding: 22px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.how-grid h3 { font-size: 14.5px; margin-bottom: 8px; }
.how-grid p { margin: 0; color: var(--muted-foreground); font-size: 13.5px; }

/* === METHODOLOGY === */
.method-page {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 44px 52px; max-width: 780px; margin: 32px auto;
}
.method-page h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -0.8px; }
.method-page .lede { color: var(--muted-foreground); margin: 0 0 28px; font-size: 16px; }
.method-page h2 { font-size: 17px; margin: 28px 0 10px; }
.method-page p { margin: 8px 0 12px; color: var(--foreground); }
.method-page ul { padding-left: 20px; margin: 8px 0 14px; }
.method-page li { margin-bottom: 5px; }
.method-page .cost-table { width: 100%; border-collapse: collapse; margin: 12px 0 24px; font-size: 13px; }
.method-page .cost-table th, .method-page .cost-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.method-page .cost-table thead th {
  background: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 700; color: var(--foreground);
}
.method-page .cost-table td.amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* === FACTSHEET PAGE — matches v0 markup === */
.fs-page { max-width: 80rem; margin: 0 auto; padding: 48px 24px 24px; }
@media (min-width: 1024px) { .fs-page { padding: 64px 24px 32px; } }

.fs-header { margin-bottom: 48px; }
@media (min-width: 1024px) { .fs-header { margin-bottom: 64px; } }

.fs-header-top {
  display: flex; flex-direction: column;
  gap: 16px; margin-bottom: 40px;
}
@media (min-width: 640px) {
  .fs-header-top { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}

.fs-eyebrow {
  font-size: 13.5px; color: var(--muted-foreground);
  letter-spacing: 1.6px; text-transform: uppercase;
  margin: 0 0 8px; font-weight: 500;
}
.fs-title-block h1 {
  font-size: 30px;
  letter-spacing: -0.8px;
  font-weight: 600; line-height: 1.15;
  text-wrap: balance;
}
@media (min-width: 1024px) {
  .fs-title-block h1 { font-size: 36px; }
}
.fs-header-meta { font-size: 13.5px; color: var(--muted-foreground); }
.fs-header-meta p { margin: 0 0 2px; }

/* hero stats — grid, NO boxes around stats */
.fs-hero-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 32px;
}
@media (min-width: 1024px) {
  .fs-hero-stats { grid-template-columns: repeat(4, 1fr); gap: 48px; }
}
.fs-stat > p { margin: 0; }
.fs-stat p + p { margin-top: 8px; }
.fs-stat-lbl {
  font-size: 13px; color: var(--muted-foreground);
  letter-spacing: 0.8px; text-transform: uppercase;
}
.fs-stat-val {
  font-size: 30px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px; color: var(--foreground);
}
.fs-stat-val.pos { color: var(--primary); }
.fs-stat-sub {
  font-size: 13.5px; color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.fs-stat-sub span { font-weight: 500; color: var(--foreground); }

/* main grid: 2/3 + 1/3 */
.fs-main {
  display: grid; grid-template-columns: 1fr;
  gap: 48px; align-items: start;
}
@media (min-width: 1024px) {
  .fs-main { grid-template-columns: 2fr 1fr; gap: 64px; }
}
.fs-col, .fs-aside { display: flex; flex-direction: column; gap: 48px; }
@media (min-width: 1024px) {
  .fs-col, .fs-aside { gap: 64px; }
}

/* NO card wrappers around chart sections — just heading + content */
.fs-section h2 {
  font-size: 18px; font-weight: 600;
  margin: 0 0 16px; color: var(--foreground);
}
.fs-section > div[id^='chart-'] { min-height: 320px; }

.fs-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.fs-section-head h2 { margin: 0; }

/* === MONTHLY RETURNS TABLE === */
.fs-monthly-wrap { overflow-x: auto; }
.fs-monthly {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 14px; min-width: 700px;
}
.fs-monthly thead th {
  padding: 8px 4px;
  font-weight: 500; color: var(--muted-foreground);
  text-align: center; font-size: 13.5px;
}
.fs-monthly thead th:first-child { text-align: left; padding-left: 0; padding-right: 12px; }
.fs-monthly thead th:last-child { padding-left: 12px; }
.fs-monthly td.fs-yr {
  font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--foreground); padding: 8px 12px 8px 0;
  font-size: 13.5px;
}
.fs-monthly td.fs-mcell { padding: 4px; width: 48px; }
.fs-monthly td.fs-mtotal { padding: 4px 0 4px 12px; }
.fs-monthly .fs-pill {
  display: block; padding: 6px 4px;
  border-radius: 4px; text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12px; font-weight: 500;
  line-height: 1.2;
}
.fs-monthly .fs-pill.total { padding: 6px 8px; font-weight: 600; }
.cell-na          { background: oklch(0.93 0.005 90); color: oklch(0.55 0.02 160); }
.cell-pos-strong  { background: oklch(0.35 0.1 160);  color: oklch(0.98 0.005 90); }
.cell-pos-mid     { background: oklch(0.50 0.10 160); color: oklch(0.98 0.005 90); }
.cell-pos-soft    { background: oklch(0.84 0.07 160); color: oklch(0.20 0.04 160); }
.cell-neg-mid     { background: oklch(0.62 0.18 25);  color: oklch(0.98 0.005 90); }
.cell-neg-soft    { background: oklch(0.85 0.08 25);  color: oklch(0.30 0.10 25); }

/* === METRICS TABLE === */
.fs-metrics {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.fs-metrics thead th {
  font-weight: 500; color: var(--muted-foreground);
  text-align: right; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.fs-metrics thead th:first-child { text-align: left; }
.fs-metrics tbody td {
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 50%, transparent);
}
.fs-metrics tbody td:first-child { color: var(--foreground); }
.fs-metrics tbody td.num {
  text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--foreground);
}
.fs-metrics tbody td.num.muted { color: var(--muted-foreground); font-weight: 400; }
.fs-metrics tbody tr:last-child td { border-bottom: none; }
.fs-metrics tbody tr.kpi-sub td {
  padding: 18px 0 6px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted-foreground); font-weight: 700;
  border-bottom: none;
}
.fs-metrics tbody tr.kpi-sub:first-child td { padding-top: 0; }

/* === HOLDINGS LIST (aside) === */
.fs-holdings-list {
  list-style: none; padding: 0; margin: 0;
}
.hl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 50%, transparent);
}
.hl-row:last-child { border-bottom: none; }
.hl-bar {
  width: 4px; height: 36px; background: var(--muted);
  border-radius: 2px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: flex-end;
}
.hl-bar-fill {
  width: 100%; background: var(--primary); border-radius: 2px;
}
.hl-main { flex: 1; min-width: 0; }
.hl-name {
  font-size: 13.5px; color: var(--foreground); font-weight: 500;
  line-height: 1.3; display: flex; align-items: center; gap: 6px;
}
.hl-name code {
  font-size: 11.5px; color: var(--muted-foreground); font-weight: 400;
}
.hl-link {
  color: var(--primary); display: inline-flex; align-items: center;
  width: 16px; height: 16px;
}
.hl-link svg { width: 12px; height: 12px; }
.hl-meta {
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 3px; font-size: 12px; color: var(--muted-foreground);
}
.hl-meta code {
  font-size: 11.5px; color: var(--muted-foreground);
}
.hl-pct { font-variant-numeric: tabular-nums; color: var(--foreground); font-weight: 600; }
.hl-val { font-variant-numeric: tabular-nums; }

/* === HOLDINGS DETAIL (legacy table — kept in case other pages still use it) === */
.fs-holdings {
  width: 100%; border-collapse: collapse;
  font-size: 13px; table-layout: auto;
}
.fs-holdings thead th {
  font-weight: 500; color: var(--muted-foreground);
  padding: 10px 6px 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px;
  white-space: nowrap;
}
.fs-holdings thead th:nth-child(2), .fs-holdings thead th:nth-child(3) { text-align: right; }
.fs-holdings thead th:nth-child(4) { text-align: center; padding-right: 0; }
.fs-holdings tbody td {
  padding: 10px 6px 10px 0;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 50%, transparent);
  vertical-align: middle;
}
.fs-holdings tbody td:first-child { width: 100%; line-height: 1.3; }
.fs-holdings tbody td:nth-child(4) { padding-right: 0; text-align: center; }
.fs-holdings tbody td .holding-name {
  display: block;
  color: var(--foreground); font-weight: 500;
  white-space: normal; word-break: break-word; font-size: 13px;
}
.fs-holdings tbody td .ticker {
  display: inline;
  color: var(--muted-foreground); font-variant-numeric: tabular-nums;
  font-size: 11.5px; margin: 0;
}
.fs-holdings tbody td.num {
  text-align: right; font-variant-numeric: tabular-nums;
  color: var(--foreground); white-space: nowrap;
}
.fs-holdings tbody td.num.bold { font-weight: 500; }
.fs-holdings tbody td.center a {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary);
  width: 24px; height: 24px; border-radius: 4px;
}
.fs-holdings tbody td.center a:hover { background: var(--muted); opacity: 1; }
.fs-holdings tbody td.center svg { width: 13px; height: 13px; }
.fs-holdings tbody tr:last-child td { border-bottom: none; }

.fs-date-picker {
  font-size: 13px; color: var(--muted-foreground);
  display: inline-flex; align-items: center; gap: 8px;
}
.fs-date-picker input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; color: var(--foreground); font-size: 13px;
  background: var(--card);
}

/* === PIE LEGEND === */
#chart-holdings { height: 256px; }
.fs-legend {
  margin-top: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.fs-leg-row {
  display: flex; align-items: center; gap: 12px; font-size: 13.5px;
}
.fs-leg-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.fs-leg-code {
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground); font-weight: 500;
  min-width: 56px;
}
.fs-leg-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--foreground);
}
.fs-leg-pct { font-variant-numeric: tabular-nums; color: var(--foreground); font-weight: 500; }

/* === ADVANCED PANEL === */
.fs-advanced {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 22px;
}
.fs-advanced summary {
  cursor: pointer; font-weight: 600; color: var(--muted-foreground);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px;
  user-select: none;
}
.fs-advanced summary:hover { color: var(--foreground); }
.fs-advanced[open] summary { margin-bottom: 16px; }
.fs-advanced form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fs-advanced label { font-size: 12px; color: var(--muted-foreground); display: flex; flex-direction: column; gap: 4px; }
.fs-advanced label.check { flex-direction: row; align-items: center; gap: 6px; grid-column: 1 / -1; font-size: 12px; }
.fs-advanced input[type=range] { width: 100%; accent-color: var(--primary); }
.fs-advanced input[type=range] + output {
  font-variant-numeric: tabular-nums; font-size: 12px; color: var(--foreground);
}
.fs-advanced input[type=number], .fs-advanced select {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--card); font: inherit; font-size: 12px; color: var(--foreground);
}
.fs-advanced button {
  grid-column: 1 / -1;
  padding: 9px 14px;
  background: var(--primary); color: var(--primary-foreground);
  border: none; border-radius: 5px; cursor: pointer;
  font-weight: 600; font-size: 13px; font-family: inherit;
}
.fs-advanced button:hover:not(:disabled) { opacity: 0.9; }
.fs-advanced #status { grid-column: 1 / -1; font-size: 12px; color: var(--muted-foreground); margin: 0; }

/* === CONTACT === */
.contact-form { display: flex; flex-direction: column; gap: 16px; max-width: 540px; }
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--foreground); font-weight: 500; }
.contact-form label .req { color: var(--destructive); }
.contact-form input, .contact-form textarea {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); font: inherit; color: var(--foreground);
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 20%, transparent);
}
.contact-form button {
  align-self: flex-start; padding: 11px 28px;
  background: var(--primary); color: var(--primary-foreground);
  border: none; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-family: inherit; font-size: 14px;
}
.contact-form button:hover { opacity: 0.9; }
.contact-form .contact-note { font-size: 12px; color: var(--muted-foreground); margin: 0; }
.contact-success {
  background: color-mix(in oklch, var(--primary) 12%, var(--background));
  border-left: 3px solid var(--primary);
  border-radius: 6px; padding: 16px 20px; margin-bottom: 24px;
  color: var(--primary); font-size: 14px; font-weight: 500;
}

@media (max-width: 1023px) {
  .product-grid, .how-grid, footer .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 36px; }
}
@media (max-width: 700px) {
  .product-grid, .how-grid, footer .footer-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; flex-direction: column; gap: 12px; align-items: flex-start; }
  .topbar nav { flex-wrap: wrap; }
  .hero { padding: 32px 16px; }
  .hero h1 { font-size: 28px; }
}
