:root {
  --bg:       #1a1a1a;
  --bg2:      #222222;
  --bg3:      #2a2a2a;
  --bg4:      #313131;
  --bg5:      #3a3a3a;
  --border:   #333333;
  --border2:  #444444;
  --text:     #e8e8e6;
  --text2:    #a0a09e;
  --text3:    #5c5c5a;
  --accent:   #d4a843;
  --accent2:  #b8922e;
  --accentbg: #2a2310;
  --green:    #4caf7d;
  --greenbg:  #0e1f16;
  --amber:    #d4a843;
  --amberbg:  #2a2310;
  --red:      #ff5252;
  --redbg:    #220d0d;
  --gold:     #ffd740;
  --goldbg:   #251e00;
  --purple:   #c084fc;
  --purplebg: #1a0a2e;
  --radius:   6px;
  --radius-lg:10px;
  --mono:     'DM Mono', monospace;
  --sans:     'DM Sans', sans-serif;
  --serif:    'Instrument Serif', serif;
  --fs:       1;
  --shadow:   0 1px 4px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: calc(14px * var(--fs));
  line-height: 1.5;
  min-height: 100vh;
}

/* ── HEADER ──────────────────────────────────────────────────────── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
  flex-wrap: nowrap;
  overflow: visible;
}
.logo {
  font-family: var(--serif);
  font-size: calc(20px * var(--fs));
  color: var(--text);
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo em { color: var(--text); font-style: italic; }

.nav-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-group::-webkit-scrollbar { display: none; }
.nav-btn {
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: calc(11px * var(--fs));
  font-weight: 500;
  color: var(--text2);
  border: none;
  background: none;
  font-family: var(--sans);
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}
.nav-btn:hover { color: #fff; background: #121212; }
.nav-btn.active { color: #ccc; background: #121212; box-shadow: none; }
.nav-badge {
  position: absolute; top: 2px; right: 4px;
  background: var(--gold); color: #111;
  font-size: 9px; font-weight: 600;
  border-radius: 8px; padding: 1px 4px;
  min-width: 15px; text-align: center;
  font-family: var(--mono);
}
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.fs-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  font-size: calc(11px * var(--fs));
}
.fs-btn {
  width: 19px; height: 19px;
  border: none; background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
  font-family: var(--mono);
}
.fs-btn:hover { background: var(--bg4); color: var(--text); }
.fs-pct {
  font-family: var(--mono);
  font-size: calc(10px * var(--fs));
  color: var(--text3);
  min-width: 32px;
  text-align: center;
  cursor: pointer;
}
.fs-pct:hover { color: var(--accent); }

.pdf-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: #000;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: calc(11px * var(--fs));
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  font-family: var(--sans);
  transition: font-weight 0.1s;
  align-self: flex-end;
}
.pdf-btn:hover { font-weight: 700; }

/* ── PAGES ────────────────────────────────────────────────────────── */
.page { display: none; height: calc(100vh - 54px); }
.page.active { display: flex; flex-direction: column; }

/* ── EMPTY / LOADING ──────────────────────────────────────────────── */
.loading-row td { text-align: center; padding: 32px; color: var(--text3); font-style: italic; font-size: calc(13px * var(--fs)); }
.no-results td { text-align: center; padding: 32px; color: var(--text3); font-size: calc(13px * var(--fs)); }

/* ── PORTFOLIO POSITIONING FACTSHEET TABLES ──────────────────────── */
.pf-fact-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(11px * var(--fs));
  table-layout: fixed;   /* locks column widths; prevents blowout from long names */
}
.pf-fact-tbl thead tr {
  background: var(--bg3);
  border-bottom: 1px solid var(--border2);
}
.pf-fact-tbl th {
  padding: 6px 8px;
  font-size: calc(10px * var(--fs));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  font-family: var(--sans);
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
}
.pf-fact-tbl th:last-child { width: 50px; text-align: right; }
.pf-fact-tbl tbody tr { border-bottom: 1px solid var(--border); }
.pf-fact-tbl tbody tr:last-child { border-bottom: none; }
.pf-fact-tbl td {
  padding: 5px 8px;
  color: var(--text2);
  font-family: var(--sans);
  font-size: calc(11px * var(--fs));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-fact-tbl td:last-child {
  font-family: var(--mono);
  text-align: right;
  white-space: nowrap;
  color: var(--text);
  overflow: hidden;
}
.pf-fact-tbl tfoot tr {
  background: var(--bg3);
  border-top: 1px solid var(--border2);
}
.pf-fact-tbl tfoot td {
  padding: 6px 8px;
  font-weight: 600;
  color: var(--text);
  border-bottom: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-fact-tbl tfoot td:last-child { font-family: var(--mono); text-align: right; overflow: hidden; }
