/* ============================
   Lead-Lag Connect — Styles
   ============================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0A1F44;
  --navy-light: #122B5C;
  --navy-dark: #061530;
  --blue-accent: #2563EB;
  --blue-accent-hover: #1D4ED8;
  --teal: #0EA5E9;
  --green: #10B981;
  --red: #EF4444;
  --orange: #F59E0B;

  /* Light theme */
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --border-color: #E2E8F0;
  --border-strong: #CBD5E1;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-on-dark: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);

  --sidebar-width: 260px;
  --topnav-height: 56px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* Dark theme */
body.dark {
  --bg-primary: #0B1120;
  --bg-secondary: #111827;
  --bg-tertiary: #1E293B;
  --border-color: #1E293B;
  --border-strong: #334155;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

/* --- Error Overlay --- */
#error-overlay {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: 420px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  z-index: 9999;
  font-family: monospace;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

body.dark #error-overlay {
  background: #450A0A;
  border-color: #7F1D1D;
  color: #FCA5A5;
}

/* ============================
   LOGIN SCREEN
   ============================ */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--navy);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
}

.login-container {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  text-align: center;
}

.login-logo-img {
  height: 40px;
  margin-bottom: 16px;
  opacity: 0.95;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: #94A3B8;
  margin-bottom: 32px;
}

.login-form {
  text-align: left;
}

.login-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  color: #FFFFFF;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.login-input:focus {
  border-color: var(--blue-accent);
  background: rgba(255,255,255,0.12);
}

.login-input::placeholder {
  color: #64748B;
}

.login-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  color: #FCA5A5;
  font-size: 13px;
}

.login-btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--blue-accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.login-btn:hover {
  background: var(--blue-accent-hover);
}

.login-footer-text {
  margin-top: 32px;
  font-size: 11px;
  color: #475569;
}

/* ============================
   TOP NAV
   ============================ */
.topnav {
  display: flex;
  align-items: center;
  height: var(--topnav-height);
  background: var(--navy);
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 50;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topnav-logo {
  height: 26px;
}

.topnav-brand {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.3px;
  opacity: 0.9;
}

.topnav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
}

.tab-btn.active {
  color: #FFFFFF;
  background: rgba(255,255,255,0.12);
}

.topnav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: background 0.15s;
}

.theme-toggle-btn:hover {
  background: rgba(255,255,255,0.15);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* ============================
   APP BODY
   ============================ */
#app {
  height: 100dvh;
  flex-direction: column;
}

.app-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-content {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ============================
   FILTER SIDEBAR
   ============================ */
#tab-search {
  flex-direction: row;
}

#tab-firms,
#tab-advisors,
#tab-dashboard {
  flex-direction: column;
}

.filter-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 0;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.filter-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.filter-clear-btn {
  font-size: 12px;
  color: var(--blue-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
}

.filter-clear-btn:hover {
  text-decoration: underline;
}

.filter-section {
  border-bottom: 1px solid var(--border-color);
}

.filter-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
}

.filter-section-toggle svg {
  transition: transform 0.2s;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.filter-section.collapsed .filter-section-toggle svg {
  transform: rotate(-90deg);
}

.filter-section-body {
  padding: 0 16px 12px;
}

.filter-section.collapsed .filter-section-body {
  display: none !important;
}

.filter-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--blue-accent);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue-accent);
  cursor: pointer;
}

/* ============================
   SEARCH BAR
   ============================ */
.search-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.search-bar-container {
  padding: 16px 20px 0;
  flex-shrink: 0;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 44px 12px 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--blue-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.search-clear:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* ============================
   RESULTS TOOLBAR
   ============================ */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  flex-shrink: 0;
}

.results-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.results-actions {
  display: flex;
  gap: 8px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.toolbar-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

/* ============================
   DATA TABLES
   ============================ */
.table-container {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.data-table th {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.data-table th.numeric {
  text-align: right;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

.sort-arrow {
  font-size: 10px;
  opacity: 0.5;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table td.numeric {
  text-align: right;
  font-weight: 500;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--bg-tertiary);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-ia {
  background: #DBEAFE;
  color: #1E40AF;
}

.badge-bd {
  background: #FEF3C7;
  color: #92400E;
}

.badge-era {
  background: #E0E7FF;
  color: #3730A3;
}

.badge-default {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

body.dark .badge-ia {
  background: rgba(37,99,235,0.2);
  color: #93C5FD;
}

body.dark .badge-bd {
  background: rgba(245,158,11,0.2);
  color: #FCD34D;
}

body.dark .badge-era {
  background: rgba(99,102,241,0.2);
  color: #A5B4FC;
}

body.dark .badge-default {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Contact icons */
.contact-icons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.contact-icon:hover {
  background: var(--blue-accent);
  color: #FFFFFF;
}

.contact-icon svg {
  width: 14px;
  height: 14px;
}

/* ============================
   EMPTY STATE
   ============================ */
.empty-state {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-tertiary);
}

.empty-state p {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-hint {
  font-size: 13px !important;
  color: var(--text-tertiary) !important;
  font-weight: 400 !important;
}

/* ============================
   PAGINATION
   ============================ */
.pagination {
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.page-btn {
  padding: 6px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s;
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.page-info {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================
   STATE SELECTOR HEADER
   ============================ */
.tab-full-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#tab-dashboard .tab-full-content {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.state-selector-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.tab-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.state-selector-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.state-dropdown {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  min-width: 180px;
}

.state-dropdown:focus {
  border-color: var(--blue-accent);
}

.state-count {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ============================
   KPI CARDS
   ============================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 0 24px;
  margin-bottom: 24px;
}

#tab-dashboard .tab-heading {
  padding: 20px 24px 16px;
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============================
   DASHBOARD CHARTS
   ============================ */
.dashboard-section {
  padding: 0 24px 24px;
}

.section-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.state-bar-chart {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 38px;
}

.bar-fill {
  width: 24px;
  background: var(--blue-accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.bar-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.bar-value {
  font-size: 8px;
  color: var(--text-tertiary);
}

/* ============================
   MODAL
   ============================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-field {
  padding: 8px 0;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-field:last-child {
  border-bottom: none;
}

.modal-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 110px;
  flex-shrink: 0;
  padding-top: 2px;
}

.modal-field-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}

.modal-field-value a {
  color: var(--blue-accent);
  text-decoration: none;
}

.modal-field-value a:hover {
  text-decoration: underline;
}

/* ============================
   LOADING OVERLAY
   ============================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 90;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--blue-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 6px 16px;
  border-radius: 100px;
  box-shadow: var(--shadow-md);
}

/* ============================
   FOOTER
   ============================ */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.app-footer a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--blue-accent);
  text-decoration: underline;
}

/* ============================
   13F HOLDINGS
   ============================ */
#tab-holdings {
  flex-direction: column;
}

.holdings-search-section {
  padding: 16px 24px 0;
  flex-shrink: 0;
}

.holdings-search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.holdings-search-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 8px 0 0;
}

.holdings-results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  flex-shrink: 0;
}

.holdings-stat-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 8px;
}

.holdings-stats {
  display: flex;
  align-items: center;
  gap: 4px;
}

.holding-tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(14,165,233,0.1);
  border: 1px solid rgba(14,165,233,0.2);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--teal);
  margin-right: 4px;
  white-space: nowrap;
}

body.dark .holding-tag {
  background: rgba(14,165,233,0.15);
  border-color: rgba(14,165,233,0.3);
}

.holdings-tags {
  max-width: 320px;
  overflow: hidden;
}

.crd-link {
  color: var(--blue-accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Holdings Modal */
.modal-holdings-section {
  margin-top: 16px;
  border-top: 2px solid var(--border-color);
  padding-top: 16px;
}

.holdings-modal-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.holdings-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  min-width: 140px;
}

.holdings-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.holdings-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.holdings-modal-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.holdings-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

.holdings-modal-table th {
  padding: 8px 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.holdings-modal-table th.numeric {
  text-align: right;
}

.holdings-modal-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-primary);
  vertical-align: middle;
}

.holdings-modal-table td.numeric {
  text-align: right;
}

.holdings-modal-table tbody tr:last-child td {
  border-bottom: none;
}

.holdings-rank {
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 11px;
  width: 30px;
}

.holdings-issuer {
  font-weight: 600;
  color: var(--text-primary);
}

.holdings-class {
  color: var(--text-tertiary);
  font-size: 11px;
}

.holdings-mv {
  font-weight: 600;
  display: block;
}

.holdings-pct {
  font-size: 10px;
  color: var(--text-tertiary);
  display: block;
}

.holdings-more-note {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

.holdings-loading {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1024px) {
  .filter-sidebar {
    width: 220px;
  }
  .topnav-tabs {
    margin-left: 12px;
  }
  .tab-btn svg {
    display: none;
  }
}

@media (max-width: 768px) {
  .filter-sidebar {
    display: none !important;
  }

  .topnav {
    padding: 0 12px;
    gap: 8px;
  }

  .topnav-brand {
    display: none;
  }

  .tab-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .tab-btn svg {
    display: none;
  }

  .topnav-tabs {
    margin-left: 4px;
  }

  .search-bar-container {
    padding: 12px 12px 0;
  }

  .results-toolbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .table-container {
    padding: 0 12px;
  }

  .state-selector-header {
    padding: 12px 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 16px;
    gap: 10px;
  }

  .dashboard-section {
    padding: 0 16px 16px;
  }

  .app-footer {
    padding: 8px 12px;
    flex-direction: column;
    gap: 4px;
  }

  .holdings-search-section {
    padding: 12px 12px 0;
  }

  .holdings-results-toolbar {
    padding: 8px 12px;
  }

  .holdings-stat-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  .holdings-modal-summary {
    gap: 8px;
  }

  .holdings-summary-item {
    min-width: 100px;
    padding: 8px 12px;
  }
}

/* ============================
   SCROLLBAR STYLING
   ============================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ========== HOLDINGS WHOLESALER LAYOUT ========== */
.holdings-layout {
  display: flex;
  gap: 0;
  height: 100%;
  min-height: calc(100vh - 120px);
}

.holdings-sidebar {
  flex-shrink: 0;
}

.holdings-main {
  flex: 1;
  min-width: 0;
  padding: 24px 32px;
  overflow-y: auto;
}

/* AUM Slider */
.aum-slider-container {
  padding: 4px 0;
}

.aum-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.aum-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.aum-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.aum-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.aum-preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.aum-preset {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.aum-preset:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Holdings Filter Stats */
.holdings-filter-stats {
  padding: 12px 16px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

.filter-stat {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.filter-stat strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Email Badge */
.email-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  background: rgba(0, 128, 100, 0.1);
  color: #007a5e;
}

.email-badge.empty {
  background: rgba(128, 128, 128, 0.08);
  color: var(--text-secondary);
  font-weight: 400;
}

[data-theme="dark"] .email-badge {
  background: rgba(0, 200, 150, 0.12);
  color: #4fc7a0;
}

[data-theme="dark"] .email-badge.empty {
  background: rgba(128, 128, 128, 0.1);
  color: var(--text-secondary);
}

/* Firm name link style */
.firm-name-link {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

.firm-name-link:hover {
  text-decoration: underline;
}

/* Custodian cell */
.custodian-cell {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Holdings results toolbar with export */
.holdings-results-toolbar .results-actions {
  display: flex;
  gap: 8px;
}

/* Responsive: Holdings on mobile */
@media (max-width: 900px) {
  .holdings-layout {
    flex-direction: column;
  }
  
  .holdings-sidebar {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .holdings-main {
    padding: 16px;
  }
}

/* ========== POSITION CHANGES TAB ========== */
.changes-intro {
  margin-bottom: 16px;
}

.changes-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.change-type-btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.change-type-btn:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.change-type-btn.active {
  background: var(--accent);
  color: white;
}

.change-type-btn.active .dot,
.change-type-btn.active .count {
  color: white;
}

.change-type-btn .count {
  background: rgba(0,0,0,0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
}

.change-type-btn.active .count {
  background: rgba(255,255,255,0.2);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-new { background: #28a745; }
.dot-inc { background: #4fc7a0; }
.dot-dec { background: #ff9500; }
.dot-exit { background: #dc3545; }

.pct-positive {
  color: #28a745;
  font-weight: 600;
}

.pct-negative {
  color: #dc3545;
  font-weight: 600;
}

[data-theme="dark"] .pct-positive { color: #4fc7a0; }
[data-theme="dark"] .pct-negative { color: #ff6b6b; }

.toolbar-btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.toolbar-btn.primary:hover {
  background: var(--accent-hover);
}

.icon-btn {
  padding: 4px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ========== ADVISOR LIST MODAL ========== */
.advisor-list-modal {
  max-height: 600px;
  overflow-y: auto;
}

.advisor-list-header {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.advisor-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.advisor-item:last-child {
  border-bottom: none;
}

.advisor-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.designation-tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  background: var(--accent);
  color: white;
  border-radius: 3px;
  font-weight: 500;
  margin-left: 6px;
}

.advisor-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.advisor-email {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.advisor-email:hover {
  text-decoration: underline;
}

.email-verified-badge {
  color: #28a745;
  font-weight: 600;
  font-size: 14px;
}

.linkedin-link {
  color: #0077b5;
  display: inline-flex;
  align-items: center;
}

.linkedin-link:hover {
  color: #005885;
}

.advisor-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Export quota display */
.export-quota {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
  cursor: help;
}

@media (max-width: 900px) {
  .export-quota { display: none; }
}
