/* ── Google Fonts ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* SpringHill dark brand palette */
  --navy:        #0A0A0A;
  --navy-mid:    #141414;
  --accent:      #DFDFDF;
  --accent-light: rgba(223,223,223,0.08);
  --accent-mid:  rgba(223,223,223,0.15);
  /* Legacy alias for compatibility */
  --teal:        var(--accent);
  --teal-light:  var(--accent-light);
  --teal-mid:    var(--accent-mid);
  --gray-50:     #111111;
  --gray-100:    #0D0D0D;
  --gray-200:    rgba(255,255,255,0.09);
  --gray-300:    rgba(255,255,255,0.18);
  --gray-500:    rgba(240,240,240,0.38);
  --gray-700:    rgba(240,240,240,0.62);
  --gray-900:    #F0F0F0;
  --white:       #171717;
  --danger:      #E05555;
  --success:     #52A87B;
  --warn:        #C9922A;
  --toolbar-h:   62px;
  --tabbar-h:    44px;
  --panel-w:     360px;

  /* Standardized border radius */
  --radius-sm:   4px;
  --radius:      6px;
  --radius-lg:   10px;
  --radius-xl:   12px;

  /* Standardized typography scale */
  --text-2xs:    0.65rem;   /* 9.75px - tiny labels */
  --text-xs:     0.75rem;   /* 11.25px - small labels, captions */
  --text-sm:     0.85rem;   /* 12.75px - secondary text */
  --text-base:   0.95rem;   /* 14.25px - body text */
  --text-md:     1rem;      /* 15px - emphasis */
  --text-lg:     1.25rem;   /* 18.75px - subheadings */
  --text-xl:     1.5rem;    /* 22.5px - headings */

  /* Standardized spacing */
  --space-1:     0.25rem;   /* 3.75px */
  --space-2:     0.5rem;    /* 7.5px */
  --space-3:     0.75rem;   /* 11.25px */
  --space-4:     1rem;      /* 15px */
  --space-5:     1.25rem;   /* 18.75px */
  --space-6:     1.5rem;    /* 22.5px */

  /* Focus ring */
  --focus-ring:  0 0 0 2px rgba(223,223,223,0.4);

  --font-serif:  'Playfair Display', Georgia, serif;
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-sans);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--gray-900);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Focus States (Accessibility) ──────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
button:focus-visible,
.tbtn:focus-visible,
.sheet-tab:focus-visible,
.q-nav-btn:focus-visible,
.pdf-close-btn:focus-visible,
.pdf-minimize-btn:focus-visible,
select:focus-visible {
  box-shadow: var(--focus-ring);
  outline: none;
}
input:focus-visible,
textarea:focus-visible {
  box-shadow: var(--focus-ring);
  border-color: var(--accent);
}
html.light :focus-visible {
  --focus-ring: 0 0 0 2px rgba(26,26,26,0.3);
}

/* ── Toolbar ───────────────────────────────────────────────── */
.toolbar {
  height: var(--toolbar-h);
  background: linear-gradient(180deg, #0F0F0F 0%, #0A0A0A 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1.5rem;
  flex-shrink: 0;
  z-index: 100;
}
.brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-right: 1.25rem;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.brand-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  display: block;
  transition: opacity 0.15s;
}
.brand-logo:hover {
  opacity: 1;
}
/* Legacy text fallback (hidden when logo loads) */
.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
  line-height: 1.1;
  font-family: var(--font-serif);
}
.brand-sub {
  font-size: 0.55rem;
  letter-spacing: 1.8px;
  color: var(--gray-500);
  text-transform: uppercase;
}
.toolbar-mid {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}
.toolbar-fund {
  color: #FFFFFF;
  font-size: 1.35rem;
  font-weight: 600;
  font-family: var(--font-serif);
  white-space: nowrap;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.toolbar-period { display: flex; gap: 0.4rem; align-items: center; }
.quarter-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 4px;
}
.quarter-display {
  font-size: 0.9rem;
  font-weight: 600;
  color: #FFFFFF;
  min-width: 80px;
  text-align: center;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 6px 12px;
  transition: all 0.15s;
  background: transparent;
}
.quarter-display:hover {
  background: rgba(255,255,255,0.1);
}
.q-nav-btn {
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: var(--radius);
  color: rgba(240,240,240,0.5);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
}
.q-nav-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #FFFFFF;
}

/* ── Quarter Picker Dropdown ─────────────────────────────── */
.q-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E1E1E;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  padding: 8px 6px;
  z-index: 500;
  min-width: 210px;
  max-height: 280px;
  overflow-y: auto;
  animation: qpFadeIn 0.12s ease;
}
@keyframes qpFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.qp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.qp-year {
  width: 38px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(240,240,240,0.35);
  flex-shrink: 0;
  text-align: right;
  padding-right: 6px;
}
.qp-item {
  flex: 1;
  text-align: center;
  padding: 5px 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(240,240,240,0.75);
  transition: background 0.08s, color 0.08s;
}
.qp-item:hover { background: rgba(255,255,255,0.1); color: rgba(240,240,240,1); }
.qp-active { background: rgba(223,223,223,0.15); color: #fff; }

/* ── New Quarter Picker Dropdown ────────────────────────────── */
.quarter-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E1E1E;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  padding: 12px;
  z-index: 500;
  min-width: 200px;
  max-height: 350px;
  overflow-y: auto;
  animation: qpFadeIn 0.12s ease;
}
.qp-year-group {
  margin-bottom: 8px;
}
.qp-year-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(240,240,240,0.4);
  margin-bottom: 4px;
  padding-left: 2px;
}
.qp-btn {
  display: inline-block;
  padding: 6px 12px;
  margin: 2px;
  border: none;
  border-radius: 5px;
  background: rgba(255,255,255,0.05);
  color: rgba(240,240,240,0.75);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.08s, color 0.08s;
}
.qp-btn:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(240,240,240,1);
}
.qp-btn.active {
  background: rgba(223,223,223,0.2);
  color: #fff;
}
html.light .quarter-picker-dropdown {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}
html.light .qp-year-label { color: rgba(0,0,0,0.4); }
html.light .qp-btn { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.7); }
html.light .qp-btn:hover { background: rgba(0,0,0,0.08); color: #111; }
html.light .qp-btn.active { background: #111; color: #fff; }
.qp-active { background: rgba(240,240,240,0.15); color: #fff; font-weight: 700; }
.tb-input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: var(--white);
  padding: 0.35rem 0.65rem;
  font-size: 0.9rem;
  width: 84px;
  text-align: center;
}
.tb-date { width: 134px; text-align: left; }
.tb-input:focus { outline: none; border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); }
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.08);
}
.dirty-dot {
  color: var(--warn);
  font-size: 0.75rem;
  animation: pulse 1.5s ease-in-out infinite;
}
.tbtn-divider {
  display: none;
}

/* Fund Switcher */
.fund-switcher {
  position: relative;
}
.fund-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.fund-switcher-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.fund-switcher-btn:active {
  transform: translateY(0);
  background: rgba(255,255,255,0.08);
}
.toolbar-fund {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.fund-chevron {
  color: var(--gray-500);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.fund-switcher.open .fund-chevron {
  transform: rotate(180deg);
}
.fund-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--navy-mid);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  min-width: 300px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.1),
    0 12px 24px rgba(0,0,0,0.25),
    0 24px 48px rgba(0,0,0,0.15);
  z-index: 200;
  overflow: hidden;
  backdrop-filter: blur(20px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.fund-dropdown.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
.fund-dropdown-header {
  padding: 12px 16px;
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gray-500);
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--gray-200);
}
.fund-dropdown-list {
  max-height: 300px;
  overflow-y: auto;
}
.fund-dropdown-loading {
  padding: 20px 14px;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.8rem;
}
.fund-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
}
.fund-dropdown-item:last-child {
  border-bottom: none;
}
.fund-dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.fund-dropdown-item:hover {
  background: rgba(255,255,255,0.08);
  padding-left: 20px;
}
.fund-dropdown-item.active {
  background: rgba(223,223,223,0.12);
  padding-left: 20px;
}
.fund-dropdown-item.active::before {
  opacity: 1;
}
.fund-dropdown-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  transition: color 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.fund-dropdown-item.active .fund-dropdown-item-name {
  font-weight: 600;
  color: var(--gray-900);
}
.fund-dropdown-item-role {
  font-size: var(--text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.12);
  color: var(--gray-700);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.fund-dropdown-item-role.editor {
  background: rgba(82, 168, 123, 0.18);
  color: var(--success);
}
.fund-dropdown-item:hover .fund-dropdown-item-role {
  background: rgba(255,255,255,0.15);
  transform: scale(1.02);
}
.fund-dropdown-item:hover .fund-dropdown-item-role.editor {
  background: rgba(82, 168, 123, 0.25);
}
.fund-dropdown-item.active .fund-dropdown-item-role {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}
.fund-dropdown-item.active .fund-dropdown-item-role.editor {
  background: rgba(82, 168, 123, 0.25);
  box-shadow: 0 0 0 1px rgba(82, 168, 123, 0.25);
}
.fund-dropdown-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--gray-500);
  font-size: 0.8rem;
}

/* Light mode fund switcher */
html.light .fund-switcher-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.1);
}
html.light .fund-switcher-btn:hover {
  background: rgba(0,0,0,0.07);
  border-color: rgba(0,0,0,0.18);
}
html.light .fund-switcher-btn:active {
  background: rgba(0,0,0,0.06);
}
html.light .toolbar-fund {
  color: #212121;
}
html.light .fund-chevron {
  color: #9E9E9E;
}
html.light .fund-dropdown {
  background: #FFFFFF;
  border-color: #E0E0E0;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.05),
    0 12px 24px rgba(0,0,0,0.1),
    0 24px 48px rgba(0,0,0,0.08);
}
html.light .fund-dropdown-header {
  background: #F8F8F8;
  border-bottom-color: #E8E8E8;
  color: #757575;
}
html.light .fund-dropdown-item {
  border-bottom-color: #F5F5F5;
}
html.light .fund-dropdown-item::before {
  background: #1A1A1A;
}
html.light .fund-dropdown-item:hover {
  background: #F8F8F8;
}
html.light .fund-dropdown-item.active {
  background: rgba(26,26,26,0.06);
}
html.light .fund-dropdown-item-name {
  color: #212121;
}
html.light .fund-dropdown-item-role {
  background: rgba(0,0,0,0.08);
  color: #616161;
}
html.light .fund-dropdown-item-role.editor {
  background: rgba(56, 142, 60, 0.12);
  color: #2E7D32;
}
html.light .fund-dropdown-item:hover .fund-dropdown-item-role {
  background: rgba(0,0,0,0.11);
}
html.light .fund-dropdown-item:hover .fund-dropdown-item-role.editor {
  background: rgba(56, 142, 60, 0.18);
}
html.light .fund-dropdown-item.active .fund-dropdown-item-role {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
html.light .fund-dropdown-item.active .fund-dropdown-item-role.editor {
  background: rgba(56, 142, 60, 0.18);
  box-shadow: 0 0 0 1px rgba(56, 142, 60, 0.15);
}

/* User Menu */
.user-menu {
  position: relative;
  margin-left: 4px;
}
.user-menu-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  padding: 5px 10px 5px 6px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-menu-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.user-menu-btn:active {
  transform: translateY(0);
  background: rgba(255,255,255,0.1);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-transform: uppercase;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-menu-btn:hover .user-avatar {
  transform: scale(1.05);
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-chevron {
  color: var(--gray-500);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-menu.open .user-chevron {
  transform: rotate(180deg);
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--navy-mid);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  min-width: 240px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.1),
    0 12px 24px rgba(0,0,0,0.25),
    0 24px 48px rgba(0,0,0,0.15);
  z-index: 200;
  overflow: hidden;
  backdrop-filter: blur(20px);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-dropdown.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
.user-dropdown-header {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid var(--gray-200);
}
.user-dropdown-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--gray-900);
  letter-spacing: -0.01em;
}
.user-dropdown-email {
  font-size: var(--text-xs);
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-sans);
  text-align: left;
  position: relative;
}
.user-dropdown-item::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: rgba(255,255,255,0.04);
  opacity: 0;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-dropdown-item:last-child::after {
  display: none;
}
.user-dropdown-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--gray-900);
  padding-left: 20px;
}
.user-dropdown-item:hover svg {
  opacity: 0.9;
  transform: translateX(2px);
}
.user-dropdown-item:active {
  background: rgba(255,255,255,0.06);
  transform: scale(0.98);
}
.user-dropdown-item svg {
  flex-shrink: 0;
  opacity: 0.7;
  width: 16px;
  height: 16px;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-dropdown-item.hidden {
  display: none;
}

/* Light mode user menu */
html.light .user-menu-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.1);
}
html.light .user-menu-btn:hover {
  background: rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.18);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
html.light .user-menu-btn:active {
  background: rgba(0,0,0,0.06);
}
html.light .user-chevron {
  color: #9E9E9E;
}
html.light .user-dropdown {
  background: #FFFFFF;
  border-color: #E0E0E0;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.05),
    0 12px 24px rgba(0,0,0,0.1),
    0 24px 48px rgba(0,0,0,0.08);
}
html.light .user-dropdown-header {
  background: #F8F8F8;
  border-bottom-color: #E8E8E8;
}
html.light .user-dropdown-name {
  color: #212121;
}
html.light .user-dropdown-email {
  color: #757575;
}
html.light .user-dropdown-divider {
  background: #EEEEEE;
}
html.light .user-dropdown-item {
  color: #616161;
}
html.light .user-dropdown-item::after {
  background: rgba(0,0,0,0.04);
}
html.light .user-dropdown-item:hover {
  background: #F8F8F8;
  color: #212121;
}
html.light .user-dropdown-item:active {
  background: #F5F5F5;
}

.tbtn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tbtn:disabled { opacity: 0.4; cursor: not-allowed; }
.tbtn.teal {
  background: linear-gradient(135deg, #FFFFFF 0%, #E8E8E8 100%);
  color: #0A0A0A;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1) inset;
}
.tbtn.teal:hover:not(:disabled) {
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.2) inset;
}
.tbtn.teal:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.tbtn.ghost {
  background: rgba(255,255,255,0.06);
  color: rgba(240,240,240,0.75);
  border: 1px solid rgba(255,255,255,0.1);
}
.tbtn.ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  color: #FFFFFF;
  transform: translateY(-1px);
}
.tbtn.ghost:active:not(:disabled) {
  transform: translateY(0);
}
.tbtn.full-w { width: 100%; justify-content: center; }
.tbtn.theme-toggle {
  padding: 8px;
  font-size: 1rem;
  min-width: 36px;
  border-radius: 50%;
  letter-spacing: 0;
  margin-right: 0.35rem;
  text-transform: none;
}

/* ── Tab Bar ───────────────────────────────────────────────── */
.tab-bar {
  height: var(--tabbar-h);
  background: #0D0D0D;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 0.5rem;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.sheet-tab {
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(240,240,240,0.4);
  background: transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
  bottom: -1px;
  height: 36px;
  display: flex;
  align-items: center;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
}
.sheet-tab:hover {
  color: rgba(240,240,240,0.75);
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
}
.sheet-tab.active {
  background: #111111;
  color: #F0F0F0;
  font-weight: 600;
  border-color: rgba(255,255,255,0.08);
  border-bottom-color: #111111;
  transform: none;
}
.sheet-tab.tab-primary { }
.sheet-tab.tab-secondary { }
.sheet-tab.tab-special { color: var(--gray-500); font-style: italic; }
.tab-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}
.dot-primary   { background: #DFDFDF; }
.dot-secondary { background: #8898DD; }
.dot-cover     { background: rgba(240,240,240,0.35); }
.dot-dashboard { background: rgba(240,240,240,0.6); }
.dot-narratives { background: var(--warn); }

/* ── Sheet Viewport ────────────────────────────────────────── */
.sheet-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--gray-50);
}
.sheet-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
.ss-loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}

/* ── Spreadsheet Table ─────────────────────────────────────── */
.ss-table {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  background: #131313;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.ss-section {
  background: #1A1A1A;
  color: rgba(240,240,240,0.55);
  padding: 8px 14px;
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ss-section-title {
  flex: 1;
}
.ss-section-edit-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: rgba(240,240,240,0.6);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
}
.ss-section-edit-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(240,240,240,0.9);
  border-color: rgba(255,255,255,0.25);
}
.ss-section-edit-btn.editing {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.ss-section-edit-btn.editing:hover {
  background: #45956d;
}
.ss-section-edit-btn .edit-icon {
  font-size: 0.75rem;
}
.ss-section.teal-section {
  background: rgba(223,223,223,0.08);
  color: var(--teal);
}
.ss-section.teal-section .ss-section-edit-btn {
  border-color: rgba(223,223,223,0.2);
  color: rgba(223,223,223,0.7);
}
.ss-section.teal-section .ss-section-edit-btn:hover {
  background: rgba(223,223,223,0.1);
  color: var(--teal);
}
.ss-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  min-height: 38px;
}
.ss-row:last-child { border-bottom: none; }
.ss-row:nth-child(even) .ss-label { background: rgba(255,255,255,0.02); }
.ss-row:nth-child(even) .ss-cell  { background: rgba(255,255,255,0.01); }
.ss-row:hover .ss-cell { background: rgba(223,223,223,0.05); }
.ss-label {
  padding: 8px 14px;
  color: rgba(240,240,240,0.55);
  background: rgba(255,255,255,0.025);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  font-weight: 500;
  font-size: 0.9rem;
}
.ss-unit {
  margin-left: 4px;
  color: rgba(240,240,240,0.3);
  font-size: 0.72rem;
  font-weight: 400;
}
.ss-cell {
  display: flex;
  align-items: center;
  background: #131313;
}
.ss-input {
  width: 100%;
  height: 100%;
  min-height: 36px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--gray-900);
  font-family: var(--font-sans);
  outline: none;
  transition: background 0.1s;
}
.ss-input:focus { background: rgba(223,223,223,0.06); outline: none; }
.ss-input.readonly { color: rgba(240,240,240,0.35); cursor: default; }
.ss-input[type="number"] { font-variant-numeric: tabular-nums; }
.ss-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
}
.ss-prefix, .ss-suffix {
  color: rgba(240,240,240,0.4);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}
.ss-prefix { padding-left: 12px; }
.ss-suffix { padding-right: 12px; }
.ss-input-wrap.has-prefix .ss-input { padding-left: 4px; }
.ss-input-wrap.has-suffix .ss-input { padding-right: 4px; }

/* Two-column wide label */
.ss-row.wide .ss-label { grid-column: span 2; border-right: none; background: rgba(255,255,255,0.02); font-weight: 400; padding: 4px 12px; color: rgba(240,240,240,0.3); font-size: 0.75rem; }

/* ── Dashboard Cards ───────────────────────────────────────── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.metric-card {
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.12);
}
.metric-label {
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(240,240,240,0.35);
  margin-bottom: 0.3rem;
  font-family: var(--font-sans);
}
.metric-value {
  font-size: 1.5rem;
  font-weight: 500;
  color: #F0F0F0;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-serif);
  letter-spacing: -0.02em;
}
.metric-sub { font-size: 0.72rem; color: rgba(240,240,240,0.38); margin-top: 0.15rem; }

/* ── Dashboard Summary Metrics Table ──────────────────────── */
.dash-summary-table {
  margin-bottom: 1.5rem;
}
.summary-metrics-table {
  width: 100%;
  border-collapse: collapse;
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9rem;
}
.summary-metrics-table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(240,240,240,0.5);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.summary-metrics-table thead th:first-child {
  width: 50%;
}
.summary-metrics-table tbody td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--gray-900);
}
.summary-metrics-table tbody tr:last-child td {
  border-bottom: none;
}
.summary-metrics-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.summary-metrics-table tbody td:first-child {
  color: rgba(240,240,240,0.7);
}
.summary-metrics-table tbody td:nth-child(2),
.summary-metrics-table tbody td:nth-child(3) {
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.summary-metrics-table .section-header td {
  padding: 0.85rem 1rem 0.5rem;
  color: rgba(240,240,240,0.9);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.summary-metrics-table .section-header:not(:first-child) td {
  border-top: 1px solid rgba(255,255,255,0.08);
}
html.light .summary-metrics-table {
  background: #FAFAFA;
  border-color: rgba(0,0,0,0.08);
}
html.light .summary-metrics-table thead th {
  color: rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.02);
  border-bottom-color: rgba(0,0,0,0.06);
}
html.light .summary-metrics-table tbody td {
  border-bottom-color: rgba(0,0,0,0.04);
}
html.light .summary-metrics-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}
html.light .summary-metrics-table tbody td:first-child {
  color: rgba(0,0,0,0.6);
}
html.light .summary-metrics-table .section-header td {
  color: rgba(0,0,0,0.85);
  background: rgba(0,0,0,0.02);
  border-bottom-color: rgba(0,0,0,0.06);
}
html.light .summary-metrics-table .section-header:not(:first-child) td {
  border-top-color: rgba(0,0,0,0.08);
}

/* ── Dashboard Pie Charts ─────────────────────────────────── */
.dash-charts-section {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}
.dash-charts-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240,240,240,0.5);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}
.dash-charts-row {
  display: flex;
  gap: 1rem;
}
.dash-chart-card {
  flex: 1;
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.dash-chart-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(240,240,240,0.6);
  margin-bottom: 0.75rem;
  text-align: center;
}
.dash-chart-svg {
  width: 140px;
  height: 140px;
}
.dash-chart-legend {
  margin-top: 0.75rem;
  width: 100%;
}
.dash-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  color: rgba(240,240,240,0.75);
  padding: 0.15rem 0;
}
.dash-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-legend-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-legend-value {
  font-weight: 500;
  color: rgba(240,240,240,0.9);
  font-variant-numeric: tabular-nums;
}
html.light .dash-charts-title {
  color: rgba(0,0,0,0.5);
}
html.light .dash-chart-card {
  background: #FAFAFA;
  border-color: rgba(0,0,0,0.08);
}
html.light .dash-chart-title {
  color: rgba(0,0,0,0.6);
}
html.light .dash-legend-item {
  color: rgba(0,0,0,0.65);
}
html.light .dash-legend-value {
  color: rgba(0,0,0,0.85);
}
@media (max-width: 700px) {
  .dash-charts-row {
    flex-direction: column;
  }
}

/* ── Dashboard Table Sections ──────────────────────────────── */
.dash-table-section {
  margin-bottom: 1.5rem;
}
.dash-table-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(240,240,240,0.8);
  margin-bottom: 0.5rem;
  padding-left: 2px;
}
html.light .dash-table-title {
  color: rgba(0,0,0,0.75);
}

/* ── Investment Summary Table ──────────────────────────────── */
.inv-table-wrap {
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow-x: auto;
  transition: box-shadow 0.15s ease;
}
.inv-table-wrap:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  table-layout: auto;
}
.inv-table thead th {
  background: #1A1A1A;
  color: rgba(240,240,240,0.5);
  padding: 10px 8px;
  text-align: left;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: normal;
  line-height: 1.4;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-family: var(--font-sans);
  vertical-align: bottom;
  min-width: 70px;
}
.inv-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
.inv-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.inv-table tbody tr:hover { background: rgba(223,223,223,0.05); }
.inv-table td {
  padding: 8px 8px;
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: rgba(240,240,240,0.8);
}
.inv-table td:first-child {
  white-space: normal;
  max-width: 180px;
}
.inv-table tfoot td {
  background: #1E1E1E;
  color: #F0F0F0;
  padding: 6px 6px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.fund-link {
  color: var(--teal);
  cursor: pointer;
  font-weight: 500;
}
.fund-link:hover { text-decoration: underline; }
.badge-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-primary   { background: rgba(223,223,223,0.1); color: var(--teal); border: 1px solid rgba(223,223,223,0.18); }
.badge-secondary { background: rgba(90,110,200,0.12); color: #8898DD; border: 1px solid rgba(90,110,200,0.22); }

/* ── Fund Sheet Sections ───────────────────────────────────── */
.fund-sheet-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.fund-sheet-name {
  font-size: 1.4rem;
  font-weight: 500;
  color: #F0F0F0;
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}
.fund-sheet-sub  { font-size: 0.78rem; color: rgba(240,240,240,0.4); }

/* Portfolio companies table */
.port-table-wrap {
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.port-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.port-table thead th {
  background: #1A1A1A;
  color: rgba(240,240,240,0.5);
  padding: 9px 12px;
  text-align: left;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-family: var(--font-sans);
}
.port-table thead th { text-align: left; }
.port-table tbody td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); color: rgba(240,240,240,0.75); }
.port-table tbody td:nth-child(n+4) { text-align: left; font-variant-numeric: tabular-nums; }
.port-table tbody tr:last-child td { border-bottom: none; }
.port-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

/* Capital calls table */
.cc-table-wrap {
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.cc-table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.cc-table thead th {
  background: rgba(223,223,223,0.08);
  color: var(--teal);
  padding: 9px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.cc-table td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: left; font-variant-numeric: tabular-nums; color: rgba(240,240,240,0.75); }
.cc-table tbody tr:last-child td { border-bottom: none; }
.empty-state {
  padding: 1.5rem;
  text-align: center;
  color: rgba(240,240,240,0.3);
  font-size: 0.82rem;
}

/* ── Narratives ────────────────────────────────────────────── */
.narr-group { margin-bottom: 1rem; }
.narr-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(240,240,240,0.35);
  margin-bottom: 0.35rem;
  padding: 0 2px;
  font-family: var(--font-sans);
}
.narr-textarea {
  width: 100%;
  min-height: 110px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: #131313;
  transition: border-color 0.15s;
}
.narr-textarea:focus { outline: none; border-color: rgba(255,255,255,0.22); }
.narr-textarea::placeholder { color: rgba(240,240,240,0.2); }
.narr-textarea.tall { min-height: 160px; }

/* ── PDF Panel ─────────────────────────────────────────────── */
.pdf-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}
.pdf-overlay.open { display: block; }

.pdf-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  z-index: 201;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.pdf-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.pdf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #1A1A1A;
  color: rgba(240,240,240,0.85);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px 12px 0 0;
}
.pdf-panel-title { font-weight: 500; font-size: 0.88rem; }
.pdf-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pdf-minimize-btn,
.pdf-close-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(240,240,240,0.7);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
}
.pdf-minimize-btn:hover,
.pdf-close-btn:hover {
  color: rgba(240,240,240,1);
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.25);
}
.pdf-close-btn:hover {
  background: rgba(224,85,85,0.2);
  border-color: rgba(224,85,85,0.4);
  color: var(--danger);
}

/* ── Minimized PDF Panel ─────────────────────────────────── */
.pdf-panel-minimized {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) scale(1);
  background: linear-gradient(135deg, #1E1E1E 0%, #141414 100%);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  padding: 0.7rem 1.4rem;
  color: rgba(240,240,240,0.9);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  z-index: 202;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: minimizedSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes minimizedSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}
.pdf-panel-minimized:hover {
  background: linear-gradient(135deg, #252525 0%, #1A1A1A 100%);
  border-color: var(--accent);
  transform: translateX(-50%) scale(1.02);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.pdf-panel-minimized:active {
  transform: translateX(-50%) scale(0.98);
}
.pdf-panel-minimized.hidden { display: none; }
.pdf-minimized-status {
  font-size: var(--text-xs);
  color: rgba(240,240,240,0.5);
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255,255,255,0.15);
}
.pdf-minimized-status:empty {
  display: none;
}
.pdf-minimized-status.processing {
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
html.light .pdf-panel-minimized {
  background: linear-gradient(135deg, #FFFFFF 0%, #F8F8F8 100%);
  border-color: rgba(0,0,0,0.12);
  color: #111111;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.03) inset;
}
html.light .pdf-panel-minimized:hover {
  background: linear-gradient(135deg, #FAFAFA 0%, #F0F0F0 100%);
  border-color: #111111;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05) inset;
}
html.light .pdf-minimized-status {
  color: rgba(0,0,0,0.5);
  border-left-color: rgba(0,0,0,0.12);
}
html.light .pdf-minimized-status.processing {
  color: #111111;
}

.pdf-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #0D0D0D;
}

.api-key-banner {
  background: rgba(255,200,0,0.08);
  border: 1px solid rgba(255,200,0,0.35);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.api-key-banner-title { font-size: 0.83rem; font-weight: 600; color: #F0E070; }
.api-key-banner-desc  { font-size: 0.78rem; color: rgba(240,240,240,0.6); margin: 0; }
.api-key-banner-desc a { color: var(--teal); }
.api-key-row { display: flex; gap: 0.5rem; align-items: center; }
.api-key-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #F0F0F0;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  outline: none;
}
.api-key-input:focus { border-color: var(--teal); }
html.light .api-key-banner { background: #FFFBE6; border-color: #F5C400; }
html.light .api-key-banner-title { color: #7A5F00; }
html.light .api-key-banner-desc  { color: #555; }
html.light .api-key-input { background: #fff; border-color: #ccc; color: #1A1A1A; }

.pdf-dropzone {
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #131313;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.pdf-dropzone:hover,
.pdf-dropzone.dragging { border-color: var(--accent); border-style: solid; background: rgba(223,223,223,0.05); }
.pdf-drop-icon { font-size: 2rem; margin-bottom: 0.5rem; opacity: 0.5; }
.pdf-dropzone p { font-size: 0.83rem; color: rgba(240,240,240,0.55); margin-bottom: 0.2rem; text-align: center; }
.pdf-hint { font-size: 0.72rem; color: rgba(240,240,240,0.3) !important; }
.link-btn { color: var(--teal); font-weight: 500; cursor: pointer; text-decoration: underline; }

.pdf-processing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(223,223,223,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  font-size: 0.83rem;
  color: rgba(240,240,240,0.7);
  font-weight: 500;
}
.mini-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pdf-doc-list { display: flex; flex-direction: column; gap: 0.5rem; }
.pdf-doc-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  overflow: hidden;
  background: #1A1A1A;
}
.pdf-doc-item.success { border-left: 3px solid var(--success); }
.pdf-doc-item.error   { border-left: 3px solid var(--danger); }
.pdf-doc-top {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
}
.pdf-doc-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; opacity: 0.6; }
.pdf-doc-info { flex: 1; min-width: 0; }
.pdf-doc-name { font-weight: 500; font-size: 0.8rem; word-break: break-word; line-height: 1.3; color: rgba(240,240,240,0.85); }
.pdf-doc-type { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(240,240,240,0.35); margin-top: 2px; }
.pdf-doc-fund { font-size: 0.78rem; color: rgba(240,240,240,0.65); margin-top: 3px; }
.pdf-doc-err  { font-size: 0.78rem; color: var(--danger); margin-top: 3px; }
/* ── Upload Progress Bar ─────────────────────────────────── */
.upload-progress-bar {
  margin-top: 8px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.upload-progress-fill.processing {
  background: linear-gradient(90deg, var(--teal), rgba(223,223,223,0.3), var(--teal));
  background-size: 200% 100%;
  animation: progressShimmer 1.5s ease-in-out infinite;
}
@keyframes progressShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
html.light .upload-progress-bar { background: rgba(0,0,0,0.1); }

.pdf-doc-duplicates {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 4px;
  font-size: 0.75rem;
}
.pdf-doc-duplicates .dup-warning {
  color: #ffc107;
  font-weight: 500;
  margin-bottom: 4px;
}
.pdf-doc-duplicates .dup-fund {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  margin-top: 2px;
}
.pdf-doc-item.has-duplicates {
  border-left-color: #ffc107;
}
.pdf-doc-bottom {
  padding: 0.4rem 0.75rem;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pdf-doc-bottom select {
  flex: 1;
  padding: 0.25rem 0.4rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  font-size: 0.78rem;
  background: #131313;
  color: rgba(240,240,240,0.75);
  color-scheme: dark;
}
.pdf-doc-bottom select:focus { outline: none; border-color: rgba(255,255,255,0.22); }
.pdf-new-fund-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.pdf-new-fund-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.new-fund-form {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(0,204,170,0.04);
  border-top: 1px solid rgba(0,204,170,0.2);
}
.new-fund-form-title { font-size: 0.78rem; font-weight: 700; color: var(--teal); margin-bottom: 0.1rem; }
.nff-label { font-size: 0.72rem; color: rgba(240,240,240,0.5); text-transform: uppercase; letter-spacing: 0.04em; }
.nff-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  color: #F0F0F0;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.nff-input:focus { border-color: var(--teal); }
.nff-type-row { display: flex; gap: 1rem; }
.nff-radio { font-size: 0.8rem; color: rgba(240,240,240,0.75); cursor: pointer; display: flex; align-items: center; gap: 0.3rem; }
.nff-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.pdf-new-created { font-size: 0.8rem; color: rgba(240,240,240,0.7); padding: 0.4rem 0; }
.pdf-new-created strong { color: #F0F0F0; }
html.light .pdf-new-fund-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.15);
  color: #111111;
}
html.light .pdf-new-fund-btn:hover {
  background: rgba(0,0,0,0.1);
  border-color: #111111;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}
html.light .new-fund-form { background: rgba(0,150,120,0.04); border-top-color: rgba(0,150,120,0.2); }
html.light .nff-label { color: #666; }
html.light .nff-input { background: #fff; border-color: #ccc; color: #1A1A1A; }
html.light .nff-radio { color: #333; }
html.light .pdf-new-created { color: #333; }

.pdf-doc-apply {
  padding: 0.25rem 0.6rem;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pdf-doc-apply:hover { background: #3EB489; color: #fff; }
.pdf-doc-apply.applied {
  background: var(--success);
  color: #fff;
  cursor: default;
}
.pdf-apply-row { margin-top: auto; padding-top: 0.5rem; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #161616;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  width: 580px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  z-index: 301;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #1A1A1A;
  color: rgba(240,240,240,0.85);
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-weight: 500;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  flex-shrink: 0;
}
.modal-steps {
  display: flex;
  align-items: center;
  padding: 0.55rem 1.25rem;
  background: #111111;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}
.modal-steps:empty { display: none; }
.wizard-step { color: rgba(240,240,240,0.28); }
.wizard-step.active { color: var(--teal); }
.wizard-step.done { color: rgba(240,240,240,0.5); }
.wizard-sep { color: rgba(240,240,240,0.18); margin: 0 0.55rem; }
.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: #1A1A1A;
  border-radius: 0 0 10px 10px;
  flex-shrink: 0;
}
.modal-hint {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.btn-row-right {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.modal-check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.3rem 0;
}
.modal-check-icon { font-size: 1rem; }
.modal-check-label { color: rgba(240,240,240,0.65); }
.modal-check-label.missing { color: var(--warn); }

/* Fund sheet narrative section */
.narr-fund-wrap {
  background: #131313;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 4rem;  /* Raised to avoid overlap with minimized PDF panel */
  right: 1.5rem;
  background: #1E1E1E;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(240,240,240,0.9);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 400;
  z-index: 9999;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}
.toast.hidden { display: none; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warn    { border-left: 3px solid var(--warn); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.muted { color: var(--gray-500); }

/* ── Light Mode ─────────────────────────────────────────────── */
html.light {
  --navy:        #FFFFFF;
  --navy-mid:    #F5F5F5;
  --teal:        #1A1A1A;
  --teal-light:  rgba(26,26,26,0.06);
  --teal-mid:    rgba(26,26,26,0.1);
  --gray-50:     #FAFAFA;
  --gray-100:    #F5F5F5;
  --gray-200:    rgba(0,0,0,0.1);
  --gray-300:    rgba(0,0,0,0.18);
  --gray-500:    rgba(0,0,0,0.42);
  --gray-700:    rgba(0,0,0,0.65);
  --gray-900:    #111111;
  --white:       #FFFFFF;
  --danger:      #DC2626;
  --success:     #16A34A;
  --warn:        #D97706;
}

/* Light mode surface overrides */
html.light body { background: #F5F5F5; }
html.light .toolbar {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFA 100%);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
html.light .brand {
  border-right-color: rgba(0,0,0,0.12);
}
html.light .toolbar-mid {
  border-left-color: transparent;
}
html.light .toolbar-right {
  border-left-color: rgba(0,0,0,0.08);
}
html.light .quarter-nav {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}
html.light .quarter-display {
  color: #111111;
}
html.light .quarter-display:hover {
  background: rgba(0,0,0,0.06);
}
html.light .q-nav-btn {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.4);
}
html.light .q-nav-btn:hover {
  background: rgba(0,0,0,0.08);
  color: #111111;
}
html.light .tbtn-divider {
  background: rgba(0,0,0,0.1);
}
html.light .brand-logo { filter: none; opacity: 1; }
html.light .tab-bar { background: #F0F0F0; border-bottom: 1px solid rgba(0,0,0,0.1); }
html.light .sheet-tab { color: rgba(0,0,0,0.42); }
html.light .sheet-tab:hover {
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.75);
  transform: translateY(-1px);
}
html.light .sheet-tab.active { background: #FFFFFF; color: #111111; border-color: rgba(0,0,0,0.1); border-bottom-color: #FFFFFF; }
html.light .sheet-viewport { background: #F5F5F5; }
html.light .ss-table { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .ss-section { background: #F0F0F0; color: rgba(0,0,0,0.5); border-bottom-color: rgba(0,0,0,0.08); }
html.light .ss-section.teal-section { background: rgba(0,0,0,0.06); color: #1A1A1A; }
html.light .ss-section-edit-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.15);
  color: rgba(0,0,0,0.55);
}
html.light .ss-section-edit-btn:hover {
  background: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.8);
  border-color: rgba(0,0,0,0.25);
}
html.light .ss-section.teal-section .ss-section-edit-btn {
  border-color: rgba(0,0,0,0.18);
  color: rgba(0,0,0,0.6);
}
html.light .ss-section.teal-section .ss-section-edit-btn:hover {
  background: rgba(0,0,0,0.06);
  color: #1A1A1A;
}
html.light .ss-row { border-bottom-color: rgba(0,0,0,0.07); }
html.light .ss-row:nth-child(even) .ss-label { background: rgba(0,0,0,0.02); }
html.light .ss-row:nth-child(even) .ss-cell { background: rgba(0,0,0,0.01); }
html.light .ss-row:hover .ss-cell { background: rgba(0,0,0,0.04); }
html.light .ss-label { background: rgba(0,0,0,0.025); border-right-color: rgba(0,0,0,0.07); color: rgba(0,0,0,0.6); }
html.light .ss-cell { background: #FFFFFF; }
html.light .ss-input { color: #111111; }
html.light .ss-input:focus { background: rgba(0,0,0,0.04); }
html.light .ss-input.readonly { color: rgba(0,0,0,0.35); }
html.light .ss-prefix, html.light .ss-suffix { color: rgba(0,0,0,0.4); }
html.light .ss-row.wide .ss-label { background: rgba(0,0,0,0.02); color: rgba(0,0,0,0.35); }
html.light .metric-card { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .metric-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: rgba(0,0,0,0.15);
}
html.light .metric-label { color: rgba(0,0,0,0.4); }
html.light .metric-value { color: #111111; }
html.light .metric-sub { color: rgba(0,0,0,0.42); }
html.light .inv-table-wrap {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.1);
}
html.light .inv-table-wrap:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
html.light .inv-table thead th { background: #F0F0F0; color: rgba(0,0,0,0.5); border-bottom-color: rgba(0,0,0,0.1); white-space: normal; }
html.light .inv-table tbody tr { border-bottom-color: rgba(0,0,0,0.07); }
html.light .inv-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }
html.light .inv-table tbody tr:hover { background: rgba(0,0,0,0.04); }
html.light .inv-table td { color: rgba(0,0,0,0.8); }
html.light .inv-table tfoot td { background: #F0F0F0; color: #111111; border-top-color: rgba(0,0,0,0.1); }
html.light .fund-sheet-name { color: #111111; }
html.light .fund-sheet-sub { color: rgba(0,0,0,0.42); }
html.light .port-table-wrap { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .port-table thead th { background: #F0F0F0; color: rgba(0,0,0,0.5); border-bottom-color: rgba(0,0,0,0.1); }
html.light .port-table tbody td { color: rgba(0,0,0,0.75); border-bottom-color: rgba(0,0,0,0.07); }
html.light .cc-table-wrap { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .cc-table thead th { background: rgba(0,0,0,0.06); color: #1A1A1A; border-bottom-color: rgba(0,0,0,0.1); }
html.light .cc-table td { color: rgba(0,0,0,0.75); border-bottom-color: rgba(0,0,0,0.07); }
html.light .narr-textarea { background: #FFFFFF; border-color: rgba(0,0,0,0.12); color: #111111; }
html.light .narr-textarea:focus { border-color: rgba(0,0,0,0.3); }
html.light .narr-label { color: rgba(0,0,0,0.45); }
html.light .pdf-panel { background: #FFFFFF; border-color: rgba(0,0,0,0.12); box-shadow: 0 24px 80px rgba(0,0,0,0.15); }
html.light .pdf-panel-header { background: #F5F5F5; color: #111111; border-bottom-color: rgba(0,0,0,0.1); }
html.light .pdf-minimize-btn,
html.light .pdf-close-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.6);
}
html.light .pdf-minimize-btn:hover {
  background: rgba(0,0,0,0.1);
  border-color: rgba(0,0,0,0.2);
  color: #111111;
}
html.light .pdf-close-btn:hover {
  background: rgba(220,38,38,0.1);
  border-color: rgba(220,38,38,0.3);
  color: #DC2626;
}
html.light .pdf-panel-body { background: #FAFAFA; }
html.light .pdf-dropzone { background: #F5F5F5; border-color: rgba(0,0,0,0.15); }
html.light .pdf-dropzone:hover { background: rgba(0,0,0,0.03); border-color: #1A1A1A; }
html.light .pdf-processing { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); }
html.light .pdf-doc-item { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .pdf-doc-name { color: #111111; }
html.light .pdf-doc-type { color: rgba(0,0,0,0.4); }
html.light .pdf-doc-fund { color: rgba(0,0,0,0.65); }
html.light .pdf-doc-bottom { background: rgba(0,0,0,0.03); border-top-color: rgba(0,0,0,0.08); }
html.light .pdf-doc-bottom select { background: #FFFFFF; border-color: rgba(0,0,0,0.15); color: #111111; color-scheme: light; }
html.light .pdf-doc-duplicates { background: rgba(255, 193, 7, 0.1); border-color: rgba(255, 193, 7, 0.4); }
html.light .pdf-doc-duplicates .dup-warning { color: #b8860b; }
html.light .pdf-doc-duplicates .dup-fund { color: rgba(0, 0, 0, 0.65); }
html.light .modal { background: #FFFFFF; border-color: rgba(0,0,0,0.12); }
html.light .modal-header { background: #F5F5F5; color: #111111; border-bottom-color: rgba(0,0,0,0.1); }
html.light .modal-steps { background: #EFEFEF; border-bottom-color: rgba(0,0,0,0.08); }
html.light .wizard-step { color: rgba(0,0,0,0.3); }
html.light .wizard-step.active { color: #111111; }
html.light .wizard-step.done { color: rgba(0,0,0,0.55); }
html.light .modal-footer { background: #F5F5F5; border-top-color: rgba(0,0,0,0.1); }
html.light .modal-check-label { color: rgba(0,0,0,0.65); }
html.light .narr-fund-wrap { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .toast {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.1);
  color: #111111;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
html.light .tbtn.ghost { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.75); border-color: rgba(0,0,0,0.15); }
html.light .tbtn.ghost:hover:not(:disabled) { background: rgba(0,0,0,0.1); }
html.light .tbtn.teal { background: #111111; color: #FFFFFF; }
html.light .tbtn.teal:hover:not(:disabled) { background: #333333; }
html.light .badge-primary { background: rgba(0,0,0,0.07); color: #333333; border-color: rgba(0,0,0,0.15); }
html.light .empty-state { color: rgba(0,0,0,0.35); }
html.light .tb-input { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.12); color: #111111; }
html.light .quarter-display { color: #111111; }
html.light .quarter-display:hover { background: rgba(0,0,0,0.07); }
html.light .q-nav-btn { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.12); color: rgba(0,0,0,0.55); }
html.light .q-nav-btn:hover { background: rgba(0,0,0,0.12); color: #111111; }
html.light .q-picker { background: #FFFFFF; border-color: rgba(0,0,0,0.1); box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
html.light .qp-year { color: rgba(0,0,0,0.35); }
html.light .qp-item { color: rgba(0,0,0,0.7); }
html.light .qp-item:hover { background: rgba(0,0,0,0.06); color: #111; }
html.light .qp-active { background: #111111; color: #fff; }
html.light .dirty-dot { color: var(--warn); }
html.light .toolbar-fund {
  color: #111111;
  text-shadow: none;
}
html.light .tbtn-divider { background: rgba(0,0,0,0.12); }
html.light .ss-loading { color: rgba(0,0,0,0.42); }
html.light .mini-spinner { border-color: rgba(0,0,0,0.12); border-top-color: #1A1A1A; }

/* ── Fund name editable header ─────────────────────────────── */
.fund-name-header-wrap { display: flex; flex-direction: column; gap: 4px; }
.fund-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fund-name-edit-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: rgba(240,240,240,0.5);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fund-name-edit-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(240,240,240,0.9);
  border-color: rgba(255,255,255,0.25);
}
.fund-name-edit-btn.editing {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
html.light .fund-name-edit-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.15);
  color: rgba(0,0,0,0.45);
}
html.light .fund-name-edit-btn:hover {
  background: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.8);
}
.fund-name-input {
  font-size: 1.45rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--gray-900);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  outline: none;
  padding: 2px 4px;
  margin: -2px -4px;
  width: 100%;
  transition: border-color 0.15s;
  cursor: text;
}
.fund-name-input:focus {
  border-bottom-color: var(--teal);
  background: rgba(255,255,255,0.04);
  border-radius: 4px 4px 0 0;
}
html.light .fund-name-input { color: #111111; }
html.light .fund-name-input:focus { background: rgba(0,0,0,0.03); border-bottom-color: #333; }

/* ── Static computed cell ──────────────────────────────────── */
.ss-static {
  font-size: 0.82rem;
  color: var(--gray-500);
  padding: 0 4px;
  font-style: italic;
}
html.light .ss-static { color: rgba(0,0,0,0.42); }

/* ── History section headers ───────────────────────────────── */
.hist-section-header {
  background: var(--navy);
  color: var(--teal);
  padding: 6px 14px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* ── Unified Add Button Base ────────────────────────────────── */
.btn-add,
.add-row-btn,
.add-entry-btn,
.add-fund-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.btn-add:hover,
.add-row-btn:hover,
.add-entry-btn:hover,
.add-fund-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.btn-add:active,
.add-row-btn:active,
.add-entry-btn:active,
.add-fund-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Light mode add buttons on light backgrounds */
html.light .hist-section-header { background: #111111; color: #FFFFFF; }
html.light .add-fund-row .add-fund-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.15);
  color: #111111;
}
html.light .add-fund-row .add-fund-btn:hover {
  background: rgba(0,0,0,0.1);
  border-color: #111111;
  color: #000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
/* Buttons inside dark headers stay light in both modes */
.hist-section-header .header-buttons {
  display: inline-flex;
  gap: 0.5rem;
  margin-left: 0.5rem;
}
.hist-section-header .add-row-btn,
.hist-section-header .add-entry-btn,
.hist-section-header .fetch-desc-btn {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.25);
  color: #FFFFFF;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
}
.hist-section-header .add-row-btn:hover,
.hist-section-header .add-entry-btn:hover,
.hist-section-header .fetch-desc-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hist-wrap {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0 0 6px 6px;
  overflow-x: auto;
  margin-bottom: 0.25rem;
}

/* ── History tables ────────────────────────────────────────── */
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.hist-table thead th {
  background: rgba(255,255,255,0.05);
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.8px;
  padding: 7px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.hist-table tbody td {
  padding: 8px 12px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.hist-table tbody tr:last-child td { border-bottom: none; }
.hist-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.hist-table .file-cell {
  font-size: 0.7rem;
  color: var(--gray-500);
  font-style: italic;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hist-table .action-cell {
  width: 50px;
  text-align: center;
  padding: 4px 8px;
}
.edit-row-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: rgba(240,240,240,0.5);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}
.edit-row-btn:hover {
  background: rgba(35,165,120,0.15);
  color: var(--teal);
}
html.light .edit-row-btn {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.45);
}
html.light .edit-row-btn:hover {
  background: rgba(35,165,120,0.1);
  color: var(--teal);
}
.delete-row-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: rgba(240,240,240,0.4);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.delete-row-btn:hover {
  background: rgba(224,85,85,0.15);
  color: var(--danger);
}

/* Summary row styling */
.hist-table tfoot .summary-row {
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.hist-table tfoot .summary-row td {
  padding: 8px 10px;
  color: rgba(240,240,240,0.85);
}
.source-file-link {
  color: var(--teal);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(223,223,223,0.3);
}
.source-file-link:hover {
  text-decoration-color: var(--teal);
}

html.light .hist-wrap { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
html.light .hist-table thead th { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.45); border-bottom-color: rgba(0,0,0,0.08); }
html.light .hist-table tbody td { color: rgba(0,0,0,0.75); border-bottom-color: rgba(0,0,0,0.06); }
html.light .hist-table tbody tr:hover { background: rgba(0,0,0,0.02); }
html.light .hist-table .file-cell { color: rgba(0,0,0,0.35); }
html.light .delete-row-btn {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.35);
}
html.light .delete-row-btn:hover {
  background: rgba(220,38,38,0.1);
  color: var(--danger);
}
html.light .edit-row-btn {
  background: transparent;
  color: rgba(100,100,100,0.5);
}
html.light .edit-row-btn:hover {
  background: rgba(100,100,100,0.1);
  color: rgba(80,80,80,0.9);
}
html.light .hist-table tfoot .summary-row {
  background: rgba(0,0,0,0.03);
  border-top-color: rgba(0,0,0,0.1);
}
html.light .hist-table tfoot .summary-row td {
  color: rgba(0,0,0,0.85);
}
html.light .source-file-link {
  color: #1A1A1A;
  text-decoration-color: rgba(0,0,0,0.25);
}
html.light .source-file-link:hover {
  text-decoration-color: #1A1A1A;
}

/* ── Edit/Add Modal overlay (uses specific ID to not conflict with wizard) ─────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}
#modal-overlay .modal-content {
  background: var(--gray-100);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--gray-900);
}
html.light .modal-content {
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* ── Add distribution form ─────────────────────────────────── */
.add-dist-form {
  background: transparent;
  padding: 0;
}
.add-form-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
  margin-bottom: 0.75rem;
}
.add-form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.add-form-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.add-form-field label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.add-form-field input,
.add-form-field select {
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--gray-900);
  font-size: 0.85rem;
  font-family: var(--font-sans);
}
.add-form-field input:focus,
.add-form-field select:focus {
  outline: none;
  border-color: var(--teal);
  background: rgba(255,255,255,0.08);
}
.add-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
html.light .add-dist-form {
  background: rgba(0,0,0,0.03);
  border-bottom-color: rgba(0,0,0,0.1);
}
html.light .add-form-title {
  color: #1A1A1A;
}
html.light .add-form-field input,
html.light .add-form-field select {
  background: #fff;
  border-color: rgba(0,0,0,0.15);
  color: #111;
}
html.light .add-form-field input:focus,
html.light .add-form-field select:focus {
  border-color: #1A1A1A;
}

/* ── Uploaded file rows ────────────────────────────────────── */
.uploaded-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.8rem;
}
.uploaded-file-row:last-child { border-bottom: none; }
.uf-icon { flex-shrink: 0; }
.uf-name { color: var(--gray-700); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uf-date { color: var(--gray-500); font-size: 0.73rem; flex-shrink: 0; }

html.light .uploaded-file-row { border-bottom-color: rgba(0,0,0,0.07); }
html.light .uf-name { color: rgba(0,0,0,0.75); }
html.light .uf-date { color: rgba(0,0,0,0.38); }

/* ── Edit mode for cells ───────────────────────────────────── */
/* Readonly inputs look like plain text */
.ss-input[readonly] {
  pointer-events: none;
  cursor: default;
  color: var(--gray-900);
}

/* Active editing state: highlight the cell */
.ss-input:not([readonly]) {
  pointer-events: auto;
  cursor: text;
  background: rgba(223,223,223,0.09);
  outline: 1px solid rgba(223,223,223,0.22);
  outline-offset: -1px;
  border-radius: 3px;
}

/* Fund name input: readonly by default */
.fund-name-input[readonly] {
  pointer-events: none;
  cursor: default;
  border-bottom-color: transparent;
}

/* Light mode overrides */
html.light .ss-input[readonly] { color: #111111; }
html.light .ss-input:not([readonly]) {
  background: rgba(0,0,0,0.05);
  outline-color: rgba(0,0,0,0.2);
}

/* ── Remove Fund Button ────────────────────────────────────── */
.remove-fund-btn {
  background: transparent;
  border: 1px solid rgba(224,85,85,0.3);
  color: rgba(224,85,85,0.7);
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: auto;
}
.remove-fund-btn:hover {
  background: rgba(224,85,85,0.12);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Fund Narrative Section (Overview & Strategy) ───────────── */
.fund-narrative-section {
  margin-top: 1rem;
  margin-bottom: 1.25rem;
}
.fund-narrative-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  min-height: 80px;
}
.fund-narrative-row:last-child {
  border-bottom: none;
}
.fund-narrative-field {
  display: contents;
}
.fund-narrative-label {
  padding: 10px 14px;
  color: rgba(240,240,240,0.55);
  background: rgba(255,255,255,0.025);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: flex-start;
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: normal;
}
.fund-narrative-textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #F0F0F0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  transition: background-color 0.15s;
}
.fund-narrative-textarea:focus {
  background: rgba(255,255,255,0.03);
  outline: none;
}
.fund-narrative-textarea[readonly] {
  color: rgba(240,240,240,0.75);
  cursor: default;
  resize: none;
}
.fund-narrative-textarea::placeholder {
  color: rgba(240,240,240,0.3);
}
html.light .fund-narrative-row {
  border-bottom-color: rgba(0,0,0,0.07);
}
html.light .fund-narrative-label {
  background: rgba(0,0,0,0.025);
  border-right-color: rgba(0,0,0,0.07);
  color: rgba(0,0,0,0.6);
}
html.light .fund-narrative-textarea {
  background: transparent;
  color: #111111;
}
html.light .fund-narrative-textarea:focus {
  background: rgba(0,0,0,0.02);
}
html.light .fund-narrative-textarea::placeholder {
  color: rgba(0,0,0,0.35);
}
html.light .fund-narrative-textarea[readonly] {
  color: rgba(0,0,0,0.7);
}

html.light .remove-fund-btn {
  border-color: rgba(220,38,38,0.25);
  color: rgba(220,38,38,0.65);
}
html.light .remove-fund-btn:hover {
  background: rgba(220,38,38,0.08);
  border-color: #DC2626;
  color: #DC2626;
}

/* ── Add Fund Row ──────────────────────────────────────────── */
.add-fund-row {
  padding: 1.25rem;
  display: flex;
  justify-content: center;
  background: rgba(255,255,255,0.02);
  border-top: 1px dashed rgba(255,255,255,0.1);
}
.add-fund-btn {
  padding: 10px 20px;
  font-size: var(--text-sm);
  border-radius: var(--radius-lg);
}
html.light .add-fund-row {
  background: rgba(0,0,0,0.02);
  border-top-color: rgba(0,0,0,0.08);
}

/* ── Add Form Field Full Width ─────────────────────────────── */
.add-form-field.full-w {
  flex: 1 1 100%;
}

/* ── Add Entry Button (in section headers) ─────────────────── */
.add-entry-btn {
  margin-left: 10px;
  padding: 4px 12px;
  font-size: var(--text-2xs);
}

/* ── Fund Tables Side by Side ─────────────────────────────── */
.fund-tables-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.fund-table-half {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
@media (max-width: 900px) {
  .fund-tables-row {
    flex-direction: column;
  }
}

/* Light mode add-entry-btn uses unified styles above */

/* ── Fund Logo Upload ─────────────────────────────────────── */
.logo-upload-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.fund-logo-preview {
  max-width: 60px;
  max-height: 40px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  padding: 2px;
}
.no-logo {
  color: var(--gray-500);
  font-size: var(--text-xs);
  font-style: italic;
}
.logo-upload-btn {
  padding: 4px 10px;
  font-size: var(--text-xs);
  background: var(--accent-light);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s;
}
.logo-upload-btn:hover {
  background: var(--accent-mid);
  color: var(--gray-900);
}
html.light .fund-logo-preview {
  background: rgba(0,0,0,0.05);
}
html.light .logo-upload-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.6);
}
html.light .logo-upload-btn:hover {
  background: rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.8);
}

/* ── Fetch Descriptions Button (base styles, overridden in headers) ── */
.fetch-desc-btn {
  padding: 4px 10px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

/* ── Description Cell ────────────────────────────────────── */
.desc-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-xs);
  color: var(--gray-500);
}
.desc-cell:hover {
  white-space: normal;
  overflow: visible;
  position: relative;
  z-index: 10;
  background: var(--navy-mid);
  padding: 4px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
html.light .desc-cell:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Report Wizard Modal ─────────────────────────────────────── */
.report-wizard-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--navy-mid);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.report-wizard-modal.hidden { display: none; }

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.wizard-header h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--gray-900);
}
.wizard-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.wizard-close:hover { color: var(--gray-900); }

.wizard-progress {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  background: rgba(0,0,0,0.2);
}
.wizard-step-indicator {
  display: flex;
  justify-content: center;
  gap: 1rem;
}
.progress-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--gray-200);
  color: var(--gray-500);
  transition: all 0.2s;
}
.progress-step.active {
  background: var(--accent);
  color: var(--navy);
}
.progress-step.completed {
  background: var(--success);
  color: white;
}

.wizard-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.wizard-footer {
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-200);
  background: rgba(0,0,0,0.1);
}

.wizard-loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-500);
}
.wizard-error {
  text-align: center;
  padding: 2rem;
  color: var(--danger);
}

.wizard-step h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}
.wizard-step-desc {
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 1.25rem;
}

/* Wizard Summary Cards */
.wizard-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.wizard-summary-card {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}
.wsc-label {
  font-size: 0.7rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.wsc-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
}

.wizard-investments-summary {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--gray-700);
}
.wis-item strong {
  color: var(--accent);
}

/* Wizard Data Review Tables */
.wizard-step-data-review {
  max-height: none;
}
.wizard-data-table {
  margin-bottom: 1.25rem;
}
.wizard-metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.wizard-metrics-table th,
.wizard-metrics-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.wizard-metrics-table th {
  background: rgba(0,0,0,0.2);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
}
.wizard-metrics-table td:not(:first-child) {
  text-align: right;
  font-weight: 500;
  min-width: 110px;
}
.wizard-metrics-table th:not(:first-child) {
  text-align: right;
}
.wizard-metrics-table .section-header td {
  background: rgba(0,0,0,0.15);
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-300);
}

/* Wizard Investment Tables */
.wizard-inv-section {
  margin-bottom: 1.25rem;
}
.wizard-inv-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent);
}
.wizard-inv-table-wrap {
  overflow-x: auto;
}
.wizard-inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.wizard-inv-table th,
.wizard-inv-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.wizard-inv-table th {
  background: rgba(0,0,0,0.2);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
}
.wizard-inv-table td:first-child {
  font-weight: 500;
  color: var(--gray-900);
}
.wizard-inv-table .summary-row td {
  background: rgba(0,0,0,0.1);
  border-top: 2px solid var(--gray-300);
}
html.light .wizard-metrics-table th,
html.light .wizard-inv-table th {
  background: rgba(0,0,0,0.05);
}
html.light .wizard-metrics-table .section-header td {
  background: rgba(0,0,0,0.03);
}
html.light .wizard-inv-table .summary-row td {
  background: rgba(0,0,0,0.03);
}

/* Wizard Warning/Success */
.wizard-warning, .wizard-success {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.wizard-warning {
  background: rgba(201, 146, 42, 0.15);
  border: 1px solid rgba(201, 146, 42, 0.3);
}
.wizard-success {
  background: rgba(82, 168, 123, 0.15);
  border: 1px solid rgba(82, 168, 123, 0.3);
}
.ww-icon, .ws-icon { font-size: 1.25rem; }
.ww-content strong, .ws-content { color: var(--gray-900); }
.ww-content p { margin: 0.25rem 0; color: var(--gray-700); font-size: 0.8rem; }
.ww-content ul { margin: 0.5rem 0 0 1rem; font-size: 0.8rem; color: var(--gray-700); }

/* Wizard Textareas */
.wizard-textarea-wrap {
  margin-bottom: 1rem;
}
.wizard-textarea-wrap label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}
.wizard-textarea {
  width: 100%;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-900);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
}
.wizard-textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.wizard-textarea.small {
  font-size: 0.8rem;
}

/* AI Actions */
.wizard-ai-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ai-suggest-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, rgba(147,112,219,0.2), rgba(75,0,130,0.2));
  border: 1px solid rgba(147,112,219,0.4);
  color: var(--gray-900);
}
.ai-suggest-btn:hover {
  background: linear-gradient(135deg, rgba(147,112,219,0.3), rgba(75,0,130,0.3));
}
.ai-icon { font-size: 1rem; }
.ai-icon.spinning {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.ai-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* Fund Narratives List */
.wizard-fund-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wizard-fund-item {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.wizard-fund-item.complete {
  border-color: rgba(82, 168, 123, 0.4);
}
.wfi-header {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  user-select: none;
}
.wfi-header:hover {
  background: rgba(255,255,255,0.03);
}
.wfi-status {
  margin-right: 0.5rem;
}
.wfi-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-900);
}
.wfi-toggle {
  font-size: 0.7rem;
  color: var(--gray-500);
  transition: transform 0.2s;
}
.wfi-form {
  padding: 0.75rem;
  border-top: 1px solid var(--gray-200);
  background: rgba(0,0,0,0.1);
}
.wfi-form.hidden { display: none; }
.wfi-field {
  margin-bottom: 0.6rem;
}
.wfi-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}
.wfi-row {
  display: flex;
  gap: 0.75rem;
}
.wfi-field.half { flex: 1; }
.wizard-input {
  width: 100%;
  padding: 0.5rem;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  color: var(--gray-900);
  font-size: 0.8rem;
}
.wizard-input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Final Review */
.wizard-review-section {
  margin-bottom: 1.25rem;
}
.wizard-review-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wizard-review-item {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}
.wri-icon {
  margin-right: 0.5rem;
}
.wri-label {
  flex: 1;
  color: var(--gray-900);
}
.wri-status {
  color: var(--gray-500);
  font-size: 0.8rem;
}
.wizard-toc {
  list-style: none;
  padding: 0;
  margin: 0;
}
.wizard-toc li {
  padding: 0.3rem 0;
  font-size: 0.85rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
}
.wizard-toc li:last-child { border-bottom: none; }
.wizard-final-note {
  background: rgba(82, 168, 123, 0.1);
  border: 1px solid rgba(82, 168, 123, 0.3);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-size: 0.85rem;
  color: var(--gray-700);
}
.wizard-final-note strong { color: var(--gray-900); }

/* Light Mode Support */
html.light .report-wizard-modal {
  background: #fff;
  border-color: #ddd;
}
html.light .wizard-header,
html.light .wizard-progress,
html.light .wizard-footer {
  border-color: #eee;
}
html.light .wizard-summary-card,
html.light .wizard-textarea,
html.light .wizard-input,
html.light .wizard-fund-item,
html.light .wfi-form {
  background: #f5f5f5;
  border-color: #ddd;
}
html.light .progress-step {
  background: #e0e0e0;
  color: #666;
}
html.light .progress-step.active {
  background: #333;
  color: #fff;
}

@media (max-width: 600px) {
  .wizard-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .report-wizard-modal {
    width: 95%;
    max-height: 90vh;
  }
}
