/* ============================
   Lead-Lag Atlas — 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; }
}

/* ========== LOOK-ALIKE FIRMS ========== */
.modal-lookalike-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.lookalike-section-title {
  font-weight: 600;
  font-size: 15px;
  color: #111827;
  margin-bottom: 2px;
}
.lookalike-sub {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
}
.lookalike-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.lookalike-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.lookalike-card:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}
.lookalike-name {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
  line-height: 1.3;
  margin-bottom: 4px;
}
.lookalike-meta {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}
.lookalike-reasons {
  font-size: 11px;
  color: #0369a1;
  line-height: 1.35;
}

/* ========== AI OUTREACH ========== */
.outreach-hint {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #78350f;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 14px;
}
.outreach-empty {
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
}
.outreach-input, .outreach-textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #111827;
  background: #fff;
}
.outreach-textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.outreach-input:focus, .outreach-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.outreach-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.btn-primary, .btn-secondary {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: 1px solid #2563eb;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
  background: #fff;
  color: #2563eb;
  border: 1px solid #93c5fd;
}
.btn-secondary:hover { background: #eff6ff; }

/* Changes table — AI Draft button alongside View */
.btn-row { display: flex; gap: 4px; }
.icon-btn-accent {
  background: #0ea5e9 !important;
  color: #fff !important;
  border-color: #0ea5e9 !important;
}
.icon-btn-accent:hover {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
}

/* ========== Q/Q INDICATORS ========== */
.qoq-col { white-space: nowrap; min-width: 140px; }
.qoq-cell { display: inline-flex; gap: 3px; justify-content: flex-end; flex-wrap: wrap; }
.qoq-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1.3;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.qoq-new   { background: #dcfce7; color: #166534; }
.qoq-inc   { background: #dbeafe; color: #1e40af; }
.qoq-dec   { background: #fef3c7; color: #92400e; }
.qoq-exit  { background: #fee2e2; color: #991b1b; }
.qoq-none, .qoq-loading { color: #9ca3af; font-size: 11px; }

/* ========== ADV FLAGS SECTION ========== */
.modal-adv-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e5e7eb; }
.adv-section-title { font-weight: 600; font-size: 15px; color: #111827; margin-bottom: 10px; }
.adv-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.adv-pill {
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
}
.adv-pill b { color: #111827; font-weight: 600; }
.adv-flag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.adv-flag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.flag-new          { background: #dbeafe; color: #1e40af; }
.flag-established  { background: #f3e8ff; color: #6b21a8; }
.flag-stale        { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.flag-recent       { background: #dcfce7; color: #166534; }
.flag-warn         { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.flag-activity     { background: #e0f2fe; color: #075985; }
.flag-default      { background: #f3f4f6; color: #4b5563; }
.adv-activities { font-size: 12px; color: #4b5563; line-height: 1.9; }
.adv-act-label { font-weight: 600; color: #374151; margin-right: 6px; }
.adv-act {
  display: inline-block;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  margin-right: 4px;
}

/* ========== FIRM INTELLIGENCE (Score / Style / Contact / Signals) ========== */
.modal-intel-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e5e7eb; }
.intel-section { display: block; }
.intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.intel-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
}
.intel-card-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.intel-score-card { background: linear-gradient(135deg, #f0f9ff, #f9fafb); }
.intel-score-value {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  margin: 4px 0 8px;
  font-feature-settings: "tnum";
}
.intel-score-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.intel-score-fill { height: 100%; transition: width .4s ease; }
.score-elite      { color: #6d28d9; }
.score-elite.intel-score-fill, .score-elite { background: linear-gradient(90deg, #7c3aed, #a78bfa); color: white; }
.intel-score-value.score-elite { background: none; -webkit-background-clip: text; background-clip: text; color: #6d28d9; }
.score-high       { color: #047857; }
.intel-score-fill.score-high { background: linear-gradient(90deg, #059669, #34d399); }
.score-mid        { color: #b45309; }
.intel-score-fill.score-mid { background: linear-gradient(90deg, #d97706, #fbbf24); }
.score-low        { color: #92400e; }
.intel-score-fill.score-low { background: #d97706; }
.score-min        { color: #6b7280; }
.intel-score-fill.score-min { background: #9ca3af; }

.score-pill {
  display: inline-block;
  font-weight: 700;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 14px;
  font-feature-settings: "tnum";
  min-width: 38px;
  text-align: center;
}
.score-pill.score-elite { background: #ede9fe; color: #6d28d9; }
.score-pill.score-high  { background: #d1fae5; color: #047857; }
.score-pill.score-mid   { background: #fef3c7; color: #b45309; }
.score-pill.score-low   { background: #fed7aa; color: #92400e; }
.score-pill.score-min   { background: #f3f4f6; color: #6b7280; }

.intel-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.intel-breakdown span {
  font-size: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 2px 6px;
  border-radius: 3px;
  color: #4b5563;
}

.intel-styles { display: flex; flex-direction: column; gap: 8px; }
.intel-style-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.intel-style-name { flex: 0 0 110px; color: #374151; font-weight: 500; }
.intel-style-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.intel-style-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}
.intel-style-pct { color: #6b7280; font-feature-settings: "tnum"; min-width: 40px; text-align: right; font-size: 11px; }
.intel-style-pill {
  display: inline-block;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  margin-right: 4px;
}
.intel-empty { color: #9ca3af; font-size: 12px; padding: 8px 0; }

.intel-actions { display: flex; flex-direction: column; gap: 6px; }
.intel-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #1e40af;
  text-decoration: none;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 4px;
  font-weight: 500;
}
.intel-action:hover { background: #eff6ff; border-color: #93c5fd; }
.intel-action svg { flex-shrink: 0; color: #2563eb; }

.intel-signals { list-style: none; padding: 0; margin: 0; font-size: 12px; line-height: 1.7; color: #374151; }
.intel-signals li { padding-left: 12px; position: relative; }
.intel-signals li::before { content: "•"; position: absolute; left: 0; color: #2563eb; font-weight: 700; }

/* ========== HOT LIST TAB ========== */
.tab-sub { color: #6b7280; font-size: 13px; margin-bottom: 18px; max-width: 800px; line-height: 1.5; }
.hotlist-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.hotlist-toolbar label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #4b5563;
}
.hotlist-toolbar select {
  font: inherit; font-size: 12px; padding: 5px 8px;
  border: 1px solid #d1d5db; border-radius: 5px; background: #fff;
}
.hotlist-stats { color: #6b7280; font-size: 13px; margin-bottom: 10px; }
.hotlist-stats strong { color: #111827; font-weight: 700; }
.hotlist-row { cursor: pointer; }
.hotlist-row:hover { background: #f9fafb !important; }
.hotlist-rank {
  font-weight: 700; color: #6b7280;
  font-feature-settings: "tnum";
  text-align: center;
  width: 50px;
}
.hotlist-signal {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 4px;
  font-weight: 500;
}

/* ========== BULK ENRICH TAB ========== */
.enrich-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  max-width: 720px;
  margin-bottom: 24px;
}
.enrich-step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
}
.enrich-step:last-child { border-bottom: none; }
.enrich-step-num {
  flex: 0 0 32px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.enrich-step-body strong {
  display: block;
  font-size: 14px;
  color: #111827;
  margin-bottom: 6px;
}
.enrich-hint {
  font-size: 11px;
  color: #6b7280;
  margin-top: 6px;
  line-height: 1.45;
}
.enrich-hint code {
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
}
.enrich-progress {
  font-size: 13px;
  color: #4b5563;
  font-feature-settings: "tnum";
}
.enrich-progress .err { color: #b91c1c; }
.enrich-progress strong { color: #047857; font-weight: 700; }
.enrich-preview h3 {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 16px 0 8px;
}
.enrich-preview .results-table {
  font-size: 11px;
}
.enrich-preview .results-table td {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
}
input[type="file"] {
  font: inherit;
  font-size: 13px;
  margin-top: 6px;
}

/* ========== DEMO MODE ========== */
.login-demo-hint {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 16px;
  text-align: center;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 8px 12px;
  border-radius: 6px;
  line-height: 1.5;
}
.login-demo-hint code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: #92400e;
  font-weight: 600;
}
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.demo-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.demo-banner-pill {
  background: rgba(0,0,0,0.18);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.demo-banner-text {
  flex: 1;
  min-width: 250px;
}
.demo-banner-cta {
  background: #fff;
  color: #b45309;
  padding: 6px 14px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.demo-banner-cta:hover { background: #fef3c7; }
body.has-demo-banner { padding-top: 38px; }
body.has-demo-banner .topnav { top: 38px; }
.demo-inline-note {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 500;
}
.contact-icon-masked {
  opacity: 0.55;
  cursor: not-allowed !important;
  position: relative;
}
.contact-icon-masked:hover { opacity: 0.7; }
.outreach-demo-watermark {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #78350f;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  text-align: center;
}
.outreach-demo-watermark a {
  color: #b45309;
  font-weight: 700;
  text-decoration: underline;
}
.btn-secondary.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
}

/* ========== MOBILE RESPONSIVE ========== */

/* Tablet: <= 1024px */
@media (max-width: 1024px) {
  .topnav { padding: 8px 12px; flex-wrap: wrap; }
  .topnav-tabs { flex-wrap: wrap; gap: 4px; }
  .tab-btn { font-size: 12px; padding: 6px 10px; }
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .results-table { font-size: 12px; }
  .results-table th, .results-table td { padding: 6px 8px; }
  .modal-content { width: 92%; max-width: 720px; }
  .intel-grid { grid-template-columns: 1fr 1fr; }
  .hotlist-toolbar { flex-wrap: wrap; gap: 8px; }
}

/* Phone: <= 700px */
@media (max-width: 700px) {
  body { font-size: 14px; }
  body.has-demo-banner { padding-top: 0; }
  body.has-demo-banner .topnav { top: 0; }
  .demo-banner { position: relative; }
  .demo-banner-inner { padding: 6px 12px; gap: 6px; flex-wrap: wrap; }
  .demo-banner-text { font-size: 12px; }
  .demo-banner-cta { font-size: 11px; padding: 4px 10px; }

  /* Top nav: stack brand + tabs */
  .topnav { padding: 6px 10px; flex-direction: column; align-items: stretch; gap: 6px; }
  .topnav-left { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
  .topnav-logo { height: 24px; }
  .topnav-brand { font-size: 16px; }
  .topnav-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .topnav-tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex: 0 0 auto; font-size: 11px; padding: 6px 10px; }
  .tab-btn svg { width: 12px; height: 12px; }
  .topnav-quota { display: none; }

  /* Tab content */
  .tab-content { padding: 12px; }
  .tab-heading { font-size: 18px; }
  .tab-sub { font-size: 12px; }

  /* Search/filter */
  .search-input, .filter-bar input, .filter-bar select { font-size: 14px; }
  .search-results { padding: 0; }

  /* Results table → card layout on phone */
  .results-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .results-table { min-width: 700px; font-size: 12px; }
  .results-table th, .results-table td {
    padding: 6px 8px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Modal */
  .modal-overlay { padding: 0; }
  .modal-content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }
  .modal-header { position: sticky; top: 0; padding: 12px 16px; }
  .modal-title { font-size: 16px; }
  .modal-body { padding: 12px 16px; }
  .modal-field-label { font-size: 11px; }
  .modal-field-value { font-size: 13px; }

  /* Intel section: 1 column */
  .intel-grid { grid-template-columns: 1fr; gap: 10px; }
  .intel-card { padding: 12px; }
  .intel-score-value { font-size: 32px; }

  /* Hot list: hide low-priority columns */
  .hotlist-toolbar { font-size: 12px; }
  .hotlist-toolbar label { font-size: 11px; }
  .hotlist-toolbar select { font-size: 12px; padding: 4px 6px; }
  .hotlist-table th:nth-child(4),
  .hotlist-table td:nth-child(4),
  .hotlist-table th:nth-child(5),
  .hotlist-table td:nth-child(5) { display: none; }

  /* Lookalike grid: single column */
  .lookalike-grid { grid-template-columns: 1fr; }

  /* Bulk Enrich */
  .enrich-card { padding: 14px; }
  .enrich-step { flex-direction: column; gap: 8px; }
  .enrich-step-num { width: 28px; height: 28px; flex: 0 0 28px; }

  /* Holdings tab Q/Q column hidden on small screens */
  .qoq-col { display: none; }

  /* Login screen */
  .login-container { padding: 20px; max-width: 100%; }
  .login-title { font-size: 22px; }
  .login-demo-hint { font-size: 11px; padding: 6px 10px; }

  /* Outreach modal */
  .outreach-textarea { min-height: 200px; font-size: 13px; }
  .outreach-actions { flex-direction: column; gap: 8px; }
  .outreach-actions .btn-primary, .outreach-actions .btn-secondary { width: 100%; text-align: center; }
}

/* Very small phones: <= 380px */
@media (max-width: 380px) {
  .tab-btn { font-size: 10px; padding: 5px 8px; }
  .tab-btn svg { display: none; }
  .topnav-brand { font-size: 14px; }
  .demo-banner-text { display: none; }
}

/* ========== MOBILE BANNER FIX ========== */
@media (max-width: 700px) {
  /* Banner becomes part of natural flow, not overlapping */
  .demo-banner {
    position: relative !important;
    z-index: 100;
  }
  body.has-demo-banner .topnav {
    position: relative !important;
    top: 0 !important;
  }
}

/* Ensure top-nav can never be overlapped by banner on any size */
.topnav { position: relative; z-index: 50; }
.demo-banner { z-index: 40; }
