/* ============================================================
   MF Analysis Platform â€” Main CSS Design System
   Dark-mode premium UI inspired by Bloomberg + Kuvera
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* -- CSS Custom Properties ------------------------------------ */
:root {
  /* Colors */
  --bg-base:        #0a0e1a;
  --bg-surface:     #0f1526;
  --bg-card:        #141929;
  --bg-card-hover:  #1a2035;
  --bg-elevated:    #1e2640;

  --border:         rgba(255,255,255,0.07);
  --border-accent:  rgba(99,102,241,0.4);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --indigo-400:     #818cf8;
  --indigo-500:     #6366f1;
  --indigo-600:     #4f46e5;
  --emerald-400:    #34d399;
  --emerald-500:    #10b981;
  --red-400:        #f87171;
  --amber-400:      #fbbf24;
  --sky-400:        #38bdf8;
  --rose-400:       #fb7185;

  --accent:         var(--indigo-500);
  --accent-glow:    rgba(99,102,241,0.15);
  --success:        var(--emerald-500);
  --danger:         var(--red-400);
  --warning:        var(--amber-400);

  /* Spacing */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 20px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 30px var(--accent-glow);

  /* Sidebar */
  --sidebar-width: 240px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* -- Reset ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 14px;
}

/* -- App Layout ----------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}
body.sidebar-scroll-lock { overflow: hidden; }

/* -- Sidebar -------------------------------------------------- */
.app-layout.sidebar-open .sidebar { transform: translateX(0); }
.app-layout.sidebar-closed .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
.app-layout.sidebar-closed .main-content { margin-left: 0; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 10px 0 30px rgba(0,0,0,0.18);
  transition: transform var(--transition), box-shadow var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 18px 14px;
  min-height: 68px;
  position: relative;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition);
}
.sidebar-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(3,7,18,0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.sidebar-nav {
  padding: 10px 10px 12px;
  flex: 1;
}
.nav-section {
  border: 1px solid transparent;
  border-radius: 10px;
  margin-bottom: 6px;
  overflow: hidden;
}
.nav-section:has(.nav-item.active) {
  background: rgba(99,102,241,0.04);
  border-color: rgba(99,102,241,0.12);
}
.nav-section-toggle {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  transition: color var(--transition), background var(--transition);
}
.nav-section-toggle:hover,
.nav-section-toggle:focus-visible {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  outline: none;
}
.nav-section-caret {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--transition);
}
.nav-section.collapsed .nav-section-caret { transform: rotate(-45deg); }
.nav-section-items {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow: hidden;
  opacity: 1;
  transition: max-height var(--transition), opacity var(--transition);
}
.nav-section.collapsed .nav-section-items {
  max-height: 0;
  opacity: 0;
}
.nav-section-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 9px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}
.nav-item.active {
  color: var(--indigo-400);
  background: var(--accent-glow);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon { font-size: 16px; width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-card-hover); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); truncate: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); }

/* -- Main Content --------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition);
  flex: 1;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-layout.sidebar-closed .main-content {
  margin-left: 0;
  width: 100%;
}

/* -- Topbar --------------------------------------------------- */
.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: all var(--transition);
}
.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus-visible {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  outline: none;
}
.sidebar-toggle-lines {
  width: 16px;
  height: 12px;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar-toggle-lines span {
  width: 100%;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  transition: transform var(--transition), opacity var(--transition);
}

.topbar {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px 0 12px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}
.sidebar-toggle-btn {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.topbar-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
  position: relative;
  z-index: 2;
}
.topbar-search input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px 8px 38px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border var(--transition);
  font-family: inherit;
  cursor: text;
  pointer-events: auto;
}
.topbar-search input:focus { border-color: var(--border-accent); outline: none; }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 3;
}
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
  display: none;
}
.search-results-dropdown.open { display: block; }
.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--bg-elevated); }
.search-result-item:last-child { border-bottom: none; }
.sri-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.sri-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topbar-btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.topbar-btn-secondary:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.topbar-btn-primary {
  background: var(--accent);
  color: white;
}
.topbar-btn-primary:hover { background: var(--indigo-600); }

/* -- Page Body ------------------------------------------------ */
.page-body {
  padding: 24px;
  flex: 1;
}
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--indigo-400); }
.breadcrumb-sep { color: var(--text-muted); }

/* -- Cards ---------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-glass {
  background: rgba(20, 25, 41, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-body { padding: 20px; }
.card-body-tight { padding: 12px 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

/* -- Stat Cards ----------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}
.stat-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1; }
.stat-change { font-size: 12px; margin-top: 6px; font-weight: 500; }
.stat-change.positive { color: var(--emerald-400); }
.stat-change.negative { color: var(--red-400); }
.stat-card-icon {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 24px;
  opacity: 0.15;
}

/* -- Pill / Badge --------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.pill-green  { background: rgba(16,185,129,0.15); color: var(--emerald-400); }
.pill-red    { background: rgba(248,113,113,0.15); color: var(--red-400); }
.pill-amber  { background: rgba(251,191,36,0.15);  color: var(--amber-400); }
.pill-indigo { background: rgba(99,102,241,0.15);  color: var(--indigo-400); }
.pill-sky    { background: rgba(56,189,248,0.15);  color: var(--sky-400); }
.pill-gray   { background: rgba(148,163,184,0.1);  color: var(--text-secondary); }

/* Stars (Morningstar) */
.star { color: var(--amber-400); }
.star-empty { color: var(--text-muted); }

/* -- Tables --------------------------------------------------- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text-secondary); }
thead th .sort-icon { margin-left: 4px; opacity: 0.4; }
thead th.sort-asc .sort-icon, thead th.sort-desc .sort-icon { opacity: 1; color: var(--indigo-400); }
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child { border-bottom: none; }
td { padding: 11px 16px; color: var(--text-primary); vertical-align: middle; }
td.muted { color: var(--text-secondary); }
td.positive { color: var(--emerald-400); font-weight: 500; }
td.negative { color: var(--red-400); font-weight: 500; }
td.code { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--indigo-400); }
td .fund-link { text-decoration: none; color: var(--text-primary); font-weight: 500; }
td .fund-link:hover { color: var(--indigo-400); }
td .fund-house { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* -- Forms ---------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border var(--transition);
  font-family: inherit;
}
.form-control:focus { border-color: var(--border-accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red-400); margin-top: 4px; }

.range-wrapper { display: flex; align-items: center; gap: 10px; }
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 99px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.range-value { font-size: 13px; font-weight: 600; color: var(--indigo-400); min-width: 60px; text-align: right; }

/* -- Buttons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--indigo-600); box-shadow: 0 0 20px rgba(99,102,241,0.4); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.btn-success { background: var(--emerald-500); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--red-400); color: white; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-loading .btn-text { opacity: 0; }
.btn-loading::after { content: ''; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; width: 14px; height: 14px; animation: spin 0.7s linear infinite; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ────────────────────────────────────────────────────────── Tabs ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(148, 163, 184, 0.12);
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar {
  height: 6px;
}
.tabs::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.1);
  border-radius: 99px;
  margin: 0 4px;
}
.tabs::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 99px;
}
.tabs::-webkit-scrollbar-thumb:hover {
  background: var(--indigo-400);
}
.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--indigo-400); border-bottom-color: var(--accent); }
.tab-panel { display: none; padding: 24px 0; }
.tab-panel.active { display: block; }

/* -- Charts --------------------------------------------------- */
.chart-container { position: relative; min-height: 320px; }
.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  color: var(--text-muted);
  flex-direction: column;
  gap: 12px;
}
.chart-placeholder .placeholder-icon { font-size: 48px; opacity: 0.3; }

/* -- Loader --------------------------------------------------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: flex; align-items: center; gap: 8px; }
.htmx-request .htmx-content { opacity: 0.4; transition: opacity var(--transition); }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* -- Progress / Donut ----------------------------------------- */
.progress-bar {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.6s ease;
}
.progress-fill.green { background: var(--emerald-500); }
.progress-fill.red { background: var(--red-400); }
.progress-fill.amber { background: var(--amber-400); }

/* -- Alert / Toast -------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: var(--emerald-400); }
.alert-warning { background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.2);  color: var(--amber-400); }
.alert-danger   { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.2); color: var(--red-400); }
.alert-info     { background: rgba(99,102,241,0.1);  border: 1px solid rgba(99,102,241,0.2);  color: var(--indigo-400); }

#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  max-width: 320px;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* -- Data Freshness ------------------------------------------- */
.data-freshness { font-size: 10px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.data-freshness.stale { color: var(--amber-400); }
.data-freshness.very-stale { color: var(--red-400); }
.freshness-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* -- Grid Layouts --------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-gap-2 { display: flex; gap: 8px; align-items: center; }

/* -- Filter Sidebar ----------------------------------------- */
.filter-sidebar { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; height: fit-content; position: sticky; top: 72px; }
.filter-section { margin-bottom: 24px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px; }
.filter-chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover, .filter-chip.selected {
  background: var(--accent-glow);
  color: var(--indigo-400);
  border-color: var(--border-accent);
}

/* Screener */
.screener-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.screener-actions { display: flex; gap: 8px; align-items: center; }
.screener-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
}
.screener-filters {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 92px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.screener-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.screener-tab {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 13px 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.screener-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--sky-400);
}
.screener-tab-panel {
  display: none;
  overflow-y: auto;
  padding: 16px 18px 86px;
}
.screener-tab-panel.active { display: block; }
.checklist {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}
.checklist.tall { max-height: 280px; }
.checklist.compact { max-height: none; }
.check-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}
.check-row input {
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(56,189,248,0.7);
  border-radius: 4px;
  margin-top: 1px;
  background: transparent;
}
.check-row input:checked {
  background: var(--sky-400);
  box-shadow: inset 0 0 0 3px var(--bg-card);
}
.range-filter {
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.range-filter:last-child { border-bottom: 0; }
.range-filter-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}
.range-filter-label output { color: var(--text-muted); font-weight: 500; }
.dual-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.screener-filter-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.screener-filter-footer .btn { width: 100%; justify-content: center; }
.screener-results { min-width: 0; }
.screener-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.compact-control {
  width: auto;
  min-width: 140px;
  padding: 7px 10px;
}
.screener-table-card { border-radius: var(--radius); }
.screener-table th,
.screener-table td { white-space: nowrap; }
.screener-table td:first-child,
.screener-table th:first-child {
  min-width: 300px;
  white-space: normal;
}
.benchmark-cell { max-width: 180px; }
.mini-pill {
  padding: 1px 6px;
  font-size: 10px;
  margin-left: 6px;
}
.pagination-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

/* Screener workspace v2 */
.screener-page { min-width: 0; }
.screener-page-header { display:flex;align-items:center;justify-content:space-between;gap:20px;padding-bottom:16px;margin-bottom:12px;border-bottom:1px solid var(--border); }
.screener-page-header h1 { font-size:25px;line-height:1.2;font-weight:750;margin:0 0 14px;letter-spacing:0; }
.screener-view-row { display:flex;align-items:center;gap:14px; }
.view-chip { display:inline-flex;align-items:center;min-height:30px;padding:0 12px;background:var(--bg-elevated);border:1px solid var(--border);border-radius:4px;color:var(--text-primary);font-size:12px;font-weight:600; }
.icon-command { color:var(--text-secondary);text-decoration:none;border:1px solid var(--border);border-radius:6px;padding:7px 12px;font-size:12px; }
.icon-command:hover { color:var(--text-primary);background:var(--bg-elevated); }
.screener-workspace { display:grid;grid-template-columns:300px minmax(0,1fr);gap:24px;align-items:start;min-width:0; }
.screener-workspace .screener-filters { background:#111726;border:1px solid var(--border);border-radius:6px;position:sticky;top:72px;height:calc(100vh - 92px);min-height:520px;overflow:hidden;display:flex;flex-direction:column; }
.screener-workspace .screener-tabs { display:grid;grid-template-columns:repeat(4,1fr);border-bottom:1px solid var(--border); }
.screener-workspace .screener-tab { background:transparent;border:0;color:var(--text-secondary);font-family:inherit;font-size:11px;font-weight:600;padding:14px 5px 12px;cursor:pointer;border-bottom:2px solid transparent; }
.screener-workspace .screener-tab.active { color:var(--text-primary);border-bottom-color:#48c9c4; }
.screener-filter-scroll { flex:1;min-height:0;overflow-y:auto; }
.screener-workspace .screener-tab-panel { display:none;padding:0 0 64px;overflow:visible; }
.screener-workspace .screener-tab-panel.active { display:block; }
.filter-block { border-bottom:1px solid var(--border);padding:0 18px 18px; }
.filter-block summary { list-style:none;display:flex;align-items:center;justify-content:space-between;padding:17px 0 13px;color:var(--text-primary);font-size:12px;font-weight:650;cursor:pointer; }
.filter-block summary::-webkit-details-marker { display:none; }
.filter-block summary::after { content:"âŒƒ";color:var(--text-muted);font-size:12px; }
.filter-block:not([open]) summary::after { content:"âŒ„"; }
.filter-search { width:100%;height:34px;background:#0c1220;border:1px solid var(--border);border-radius:5px;padding:0 10px;color:var(--text-primary);font:inherit;font-size:11px;outline:0; }
.filter-search:focus { border-color:rgba(72,201,196,.55); }
.filter-search::placeholder { color:var(--text-muted); }
.filter-block .checklist { margin-top:10px;display:flex;flex-direction:column;gap:10px;max-height:205px;overflow-y:auto;padding-right:4px; }
.filter-block .checklist.tall { max-height:300px; }
.filter-block .checklist.compact { max-height:none; }
.filter-block .check-row { display:grid;grid-template-columns:16px minmax(0,1fr);align-items:start;gap:8px;color:var(--text-secondary);font-size:12px;line-height:1.35;cursor:pointer; }
.filter-block .check-row input { appearance:none;width:14px;height:14px;border:1px solid rgba(72,201,196,.75);border-radius:3px;margin-top:1px;background:transparent; }
.filter-block .check-row input:checked { background:#48c9c4;box-shadow:inset 0 0 0 3px #111726; }
.range-control { --range-low:0%;--range-high:100%; }
.range-values { display:flex;justify-content:space-between;color:var(--text-muted);font-size:11px;margin-bottom:7px; }
.dual-range { position:relative;height:18px; }
.dual-range::before { content:"";position:absolute;left:0;right:0;top:8px;height:4px;border-radius:4px;background:linear-gradient(to right,#293147 0 var(--range-low),#48c9c4 var(--range-low) var(--range-high),#293147 var(--range-high) 100%); }
.dual-range input[type="range"] { position:absolute;inset:0;width:100%;height:18px;margin:0;background:transparent;pointer-events:none; }
.dual-range input[type="range"]::-webkit-slider-thumb { pointer-events:auto;width:15px;height:15px;border:2px solid #48c9c4;background:#111726;box-shadow:none; }
.range-presets { display:flex;flex-wrap:wrap;gap:6px;margin-top:8px; }
.range-presets button { border:1px solid var(--border);border-radius:12px;background:transparent;color:var(--text-muted);font:inherit;font-size:9px;padding:3px 7px;cursor:pointer; }
.range-presets button:hover { border-color:rgba(72,201,196,.5);color:var(--text-secondary); }
.screener-workspace .screener-filter-footer { position:static;flex-shrink:0;padding:12px 18px;border-top:1px solid var(--border);background:#111726; }
.screener-workspace .screener-filter-footer .btn { width:100%;justify-content:center; }
.screener-results { min-width:0; }
.results-toolbar { display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px; }
.results-search { display:flex;align-items:center;gap:8px;width:min(430px,55%);height:38px;border:1px solid var(--border);border-radius:6px;background:#0d1321;padding:0 12px;color:var(--text-muted); }
.results-search input { flex:1;min-width:0;border:0;outline:0;background:transparent;color:var(--text-primary);font:inherit;font-size:12px; }
.results-search input::placeholder { color:var(--text-muted); }
.results-actions { display:flex;gap:8px; }
.toolbar-button { min-height:38px;display:inline-flex;align-items:center;justify-content:center;gap:8px;background:transparent;color:var(--text-primary);border:1px solid var(--border);border-radius:6px;padding:0 13px;font:inherit;font-size:12px;font-weight:600;text-decoration:none;cursor:pointer; }
.toolbar-button:hover { background:var(--bg-elevated);border-color:rgba(255,255,255,.13); }
.column-menu-wrap { position:relative; }
.column-menu { position:absolute;top:calc(100% + 7px);right:0;z-index:25;width:210px;padding:12px;background:#151c2d;border:1px solid var(--border);border-radius:6px;box-shadow:0 18px 50px rgba(0,0,0,.45); }
.column-menu-title { color:var(--text-muted);font-size:10px;text-transform:uppercase;margin-bottom:8px; }
.column-menu label { display:flex;align-items:center;gap:8px;padding:5px 0;color:var(--text-secondary);font-size:11px; }
.results-meta { min-height:42px;display:flex;align-items:center;justify-content:space-between;color:var(--text-secondary);font-size:11px; }
.sort-summary { color:var(--text-muted); }
.screener-table-shell { border:1px solid var(--border);border-radius:6px;overflow:hidden;background:#0d1321; }
.screener-workspace .screener-table { min-width:1040px; }
.screener-workspace .screener-table th,.screener-workspace .screener-table td { white-space:nowrap;text-align:right;border-right:0; }
.screener-workspace .screener-table thead th { height:48px;text-transform:none;letter-spacing:0;font-size:11px;font-weight:550;text-align:right;cursor:default;background:#0f1524; }
.screener-workspace .screener-table tbody td { height:70px;padding-top:12px;padding-bottom:12px; }
.screener-workspace .screener-table th[data-column="scheme"],.screener-workspace .screener-table td[data-column="scheme"] { min-width:315px;white-space:normal;text-align:left; }
.screener-workspace .screener-table .favorite-column { width:46px;min-width:46px;padding-left:12px;padding-right:6px;text-align:center; }
.table-sort { border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;padding:0; }
.table-sort:hover { color:var(--text-primary); }
.table-sort span { color:var(--text-muted);margin-left:5px; }
.favorite-button { border:0;background:transparent;color:var(--text-muted);font-size:19px;line-height:1;cursor:pointer; }
.favorite-button.active { color:var(--amber-400); }
.scheme-tags { display:flex;align-items:center;flex-wrap:wrap;gap:5px;margin-top:5px; }
.scheme-tags span { border:1px solid var(--border);border-radius:3px;padding:1px 4px;color:var(--text-secondary);font-size:9px; }
.scheme-tags small { color:var(--text-muted);font-size:9px;margin-left:3px; }
.risk-badge { display:inline-flex;padding:2px 7px;border-radius:10px;background:rgba(148,163,184,.1);color:var(--text-secondary);font-size:10px; }
.risk-badge.risk-low { color:var(--emerald-400);background:rgba(52,211,153,.1); }
.risk-badge.risk-high,.risk-badge.risk-veryhigh { color:var(--red-400);background:rgba(248,113,113,.1); }
.report-link { display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border:1px solid var(--border);border-radius:5px;color:var(--text-secondary);text-decoration:none; }
.report-link:hover { color:var(--text-primary);background:var(--bg-elevated); }
[data-column][hidden] { display:none !important; }
.screener-workspace .benchmark-cell { max-width:180px; }
.pagination-row { display:flex;justify-content:center;align-items:center;gap:12px;margin-top:18px; }
.screener-empty { min-height:240px;border:1px solid var(--border);border-radius:6px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;color:var(--text-muted); }
.screener-empty strong { color:var(--text-primary); }

/* -- Fund Card ------------------------------------------------ */
.fund-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.fund-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.fund-card-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.4; margin-bottom: 4px; }
.fund-card-house { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.fund-card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fund-metric-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fund-metric-value { font-size: 14px; font-weight: 700; margin-top: 2px; }
.fund-metric-value.positive { color: var(--emerald-400); }
.fund-metric-value.negative { color: var(--red-400); }
.fund-metric-value.neutral { color: var(--text-primary); }

/* -- Metric Definition Grid ----------------------------------- */
.metrics-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; }
.metrics-dl > div { padding: 14px 16px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.metrics-dl > div:last-child { border-bottom: none; }
.metric-key { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.metric-val { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.metric-val small { font-size: 11px; color: var(--text-secondary); font-weight: 400; }

/* -- Market Ticker Strip -------------------------------------- */
.market-strip {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
}
.market-strip::-webkit-scrollbar { display: none; }
.market-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; cursor: default; }
.market-name { font-size: 10px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.market-val  { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.market-val.msi-na { color: var(--text-muted); font-weight: 400; font-size: 11px; }
.market-chg  { font-size: 10px; font-weight: 600; }
.market-chg.up   { color: var(--emerald-400); }
.market-chg.down { color: var(--red-400); }
.market-manage-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(129, 140, 248, 0.12); border: 1px solid rgba(129, 140, 248, 0.3);
  color: var(--indigo-400, #818cf8); border-radius: 8px;
  padding: 3px 8px; font-size: 12px; line-height: 1; cursor: pointer;
  flex-shrink: 0; margin-left: 6px; transition: all 0.15s ease;
}
.market-manage-btn:hover {
  background: rgba(129, 140, 248, 0.25); border-color: var(--indigo-400, #818cf8);
  color: #ffffff; transform: scale(1.05);
}

/* Category colour dots */
.msi-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.msi-dot-index     { background: var(--blue-400,#60a5fa); }
.msi-dot-sentiment { background: var(--yellow-400,#facc15); }
.msi-dot-technical { background: var(--purple-400,#c084fc); }
.msi-dot-valuation { background: var(--orange-400,#fb923c); }
.msi-dot-macro     { background: var(--teal-400,#2dd4bf); }
.msi-dot-global    { background: var(--indigo-400,#818cf8); }
.msi-dot-fund      { background: var(--emerald-400,#34d399); }

/* Signal badges */
.msi-signal { font-size: 9px; padding: 1px 5px; border-radius: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.msi-signal-bullish  { background: rgba(52,211,153,.15); color: var(--emerald-400,#34d399); }
.msi-signal-bearish  { background: rgba(248,113,113,.15); color: var(--red-400,#f87171); }
.msi-signal-oversold { background: rgba(52,211,153,.12); color: var(--emerald-400,#34d399); }
.msi-signal-overbought{ background: rgba(248,113,113,.12); color: var(--red-400,#f87171); }
.msi-signal-neutral  { background: rgba(148,163,184,.12); color: var(--text-muted); }

/* Info button */
.msi-info-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 11px; padding: 0 2px;
  line-height: 1; opacity: 0.6; transition: opacity 0.15s;
}
.msi-info-btn:hover { opacity: 1; color: var(--text-accent, #60a5fa); }

/* Tooltip hover card */
.msi-tooltip-popup {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.msi-tooltip-popup.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.msi-tooltip-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  max-width: 300px;
  min-width: 200px;
  width: max-content;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}
.msi-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.msi-tip-section {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.msi-tip-section:last-child { margin-bottom: 0; }
.msi-tip-section strong { color: var(--text-primary); }
.msi-tip-interp { background: rgba(52,211,153,.06); border-radius: 8px; padding: 7px 9px; }
.msi-tip-threshold {
  font-size: 11px; color: var(--text-muted); font-style: italic;
  padding: 5px 8px; border-left: 3px solid var(--border);
  background: var(--bg-surface); border-radius: 0 6px 6px 0;
}

/* Manage modal for mkt strip */
.mkt-modal { position:fixed;inset:0;z-index:1200;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.6);backdrop-filter:blur(4px);opacity:0;pointer-events:none;transition:opacity .2s }
.mkt-modal.open { display:flex !important;opacity:1 !important;pointer-events:auto !important }
.mkt-modal-box { background:var(--bg-card);border:1px solid var(--border);border-radius:16px;padding:22px;max-width:560px;width:calc(100vw - 32px);max-height:85vh;overflow-y:auto;box-shadow:0 24px 64px rgba(0,0,0,.35) }

/* Mkt modal tab nav */
.msi-tab-nav { display:flex;gap:6px;margin-bottom:16px;flex-wrap:wrap }
.msi-tab-btn { padding:6px 14px;border-radius:20px;font-size:12px;font-weight:500;border:1px solid var(--border);background:var(--bg-surface);color:var(--text-muted);cursor:pointer;transition:all .15s ease }
.msi-tab-btn:hover { color:var(--text-primary);border-color:rgba(129,140,248,0.4) }
.msi-tab-btn.active { background:rgba(99,102,241,0.22);border-color:var(--indigo-400,#818cf8);color:#a5b4fc;font-weight:600;box-shadow:0 0 12px rgba(99,102,241,0.2) }
.msi-tab-panel { display:none } .msi-tab-panel.active { display:block }

/* metric chip in manage modal */
.msi-metric-chip { display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:20px;border:1px solid var(--border);background:var(--bg-surface);cursor:pointer;margin:3px;transition:all .15s;font-size:12px;color:var(--text-secondary) }
.msi-metric-chip.selected { border-color:var(--emerald-400,#34d399);background:rgba(52,211,153,.1);color:var(--text-primary) }
.msi-metric-chip input[type=checkbox] { display:none }
.msi-cat-header { font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.06em;margin:12px 0 6px }

/* API key section */
.msi-apikey-row { display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;margin-bottom:8px;background:var(--bg-surface) }
.msi-apikey-badge { font-size:10px;padding:2px 7px;border-radius:10px;font-weight:700 }
.msi-apikey-badge.valid { background:rgba(52,211,153,.15);color:var(--emerald-400,#34d399) }
.msi-apikey-badge.invalid { background:rgba(248,113,113,.15);color:var(--red-400,#f87171) }

/* Fund metric builder */
.msi-fund-select { display:flex;flex-direction:column;gap:10px;margin-top:8px }

/* -- Upload Drop Zone ----------------------------------------- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.drop-zone .dz-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.drop-zone .dz-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.drop-zone .dz-sub { font-size: 12px; color: var(--text-muted); }

/* -- Auth Pages ----------------------------------------------- */
.auth-wrapper {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-card);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 8px; }
.auth-sub { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 28px; }

/* -- Calculator ----------------------------------------------- */
.calc-layout { display: grid; grid-template-columns: 380px 1fr; gap: 24px; }
.calc-inputs { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.calc-results { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.calc-result-highlight {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}
.calc-result-highlight .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.calc-result-highlight .value { font-size: 36px; font-weight: 800; color: var(--emerald-400); letter-spacing: -0.03em; margin: 4px 0; }
.calc-result-highlight .sub { font-size: 12px; color: var(--text-secondary); }

/* -- Market Ticker Strip -------------------------------------- */
.market-strip {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  gap: 32px;
  overflow-x: auto;
  scrollbar-width: none;
}
.market-strip::-webkit-scrollbar { display: none; }
.market-item { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.market-name { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.market-val { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.market-chg { font-size: 11px; font-weight: 500; }
.market-chg.up { color: var(--emerald-400); }
.market-chg.down { color: var(--red-400); }

/* -- Report / Print ------------------------------------------- */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #e2e8f0; }
}

/* -- Responsive ----------------------------------------------- */
@media (max-width: 1024px) {
  .topbar { z-index: 50; }
  .sidebar {
    z-index: 160;
    width: min(280px, calc(100vw - 48px));
    transform: translateX(-100%);
    box-shadow: 18px 0 42px rgba(0,0,0,0.45);
  }
  .app-layout.sidebar-open .sidebar { transform: translateX(0); }
  .app-layout.sidebar-closed .sidebar { transform: translateX(-100%); }
  .main-content,
  .app-layout.sidebar-open .main-content,
  .app-layout.sidebar-closed .main-content { margin-left: 0; }
  .app-layout.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  .calc-layout { grid-template-columns: 1fr; }
  .screener-workspace { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
  .screener-workspace .screener-filters {
    position: relative;
    top: 0;
    height: auto;
    max-height: none;
    min-height: 0;
  }
  .screener-filter-scroll { max-height: 520px; }
  .results-search { width: min(520px, 100%); }
  .screener-shell {
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
  }
  .screener-filters,
  .screener-results,
  .screener-table-card {
    min-width: 0;
    max-width: 100%;
  }
  .screener-filters {
    position: relative;
    top: 0;
    max-height: none;
  }
  .screener-tab-panel { max-height: 420px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .topbar {
    height: 52px;
    padding: 0 8px;
    gap: 8px;
    overflow: visible;
  }
  .sidebar-toggle-btn {
    display: inline-flex !important;
    width: 36px;
    min-width: 36px;
    height: 36px;
    flex-shrink: 0;
    order: 0;
    position: relative;
    z-index: 1;
  }
  .topbar-search {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    z-index: 2;
  }
  .topbar-actions { display: none; }
  .topbar-btn { padding: 6px 8px; }
  .page-body { padding: 16px; }
  /* Fix: prevent content from being shifted on small screens */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .screener-page-header,
  .results-toolbar,
  .results-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .results-actions { width: 100%; }
  .toolbar-button { flex: 1; }
  .screener-workspace .screener-tabs { grid-template-columns: repeat(2, 1fr); }
  .column-menu { left: 0; right: auto; width: min(240px, calc(100vw - 32px)); }
  .screener-header,
  .screener-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .screener-actions,
  .screener-toolbar .flex-gap-2 {
    flex-wrap: wrap;
  }
  .compact-control { width: 100%; }
  .screener-tabs { grid-template-columns: repeat(2, 1fr); }
  .screener-table { min-width: 980px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .topbar-actions { display: none; }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* -- Scrollbar ------------------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* -- Info Button & Tooltip System ------------------------------ */
/* The â“˜ button that appears inline next to labels */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 5px;
  position: relative;
  transition: all 0.15s ease;
  font-family: 'Inter', sans-serif;
  line-height: 1;
  flex-shrink: 0;
  padding: 0;
  outline: none;
  text-decoration: none;
  /* Prevent button from inheriting table/metric styles */
  font-style: normal;
  letter-spacing: 0;
}

/* ============================================================
   Mobile Breakpoint & Responsive UI/UX Enhancements
   ============================================================ */

/* Horizontal Scrollable Tab Navigation across all hubs */
.tab-nav-scroll,
.amc-tabs,
.fund-tabs,
.sub-tabs,
.category-tabs,
.calc-nav-tabs,
.fund-nav-tabs,
.tab-list {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: 100%;
  padding-bottom: 2px;
}
.tab-nav-scroll::-webkit-scrollbar,
.amc-tabs::-webkit-scrollbar,
.fund-tabs::-webkit-scrollbar,
.sub-tabs::-webkit-scrollbar,
.category-tabs::-webkit-scrollbar,
.calc-nav-tabs::-webkit-scrollbar,
.fund-nav-tabs::-webkit-scrollbar,
.tab-list::-webkit-scrollbar {
  display: none;
}

/* Responsive Table Wrappers & Sticky Headers */
.table-responsive,
.data-table-wrap,
#funds-container,
#port-container,
.screener-table-card {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.data-table th:first-child,
.data-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 10;
}
.data-table thead th:first-child {
  z-index: 25;
}

/* Plotly Chart Responsive Containers */
.js-plotly-plot,
.plot-container,
.chart-container,
.plotly-graph-div {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Mobile Breakpoints: Tablet (<= 768px) */
@media (max-width: 768px) {
  .calc-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .grid-4, .grid-3 {
    grid-template-columns: 1fr;
  }
  .metric-card, .card, .section-card {
    padding: 14px 16px;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .btn, .button, .form-control, .form-select {
    min-height: 38px;
    touch-action: manipulation;
  }
}

/* Mobile Breakpoints: Smartphone (<= 640px) */
@media (max-width: 640px) {
  .page-body {
    padding: 12px;
  }
  .data-table th,
  .data-table td {
    padding: 7px 9px;
    font-size: 11.5px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Mobile Breakpoints: Small Smartphone (<= 480px) */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-card {
    padding: 12px;
  }
  .metric-card-val {
    font-size: 17px;
  }
}



.info-btn:hover,
.info-btn:focus,
.info-btn.active {
  background: rgba(99,102,241,0.15);
  border-color: var(--indigo-400);
  color: var(--indigo-400);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* The tooltip popup panel */
.info-tooltip {
  position: fixed;
  z-index: 9990;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: #1a2035;
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.1);
  padding: 0;
  opacity: 0;
  transform: scale(0.95) translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  backdrop-filter: blur(16px);
  overflow: hidden;
}
.info-tooltip.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Tooltip header */
.info-tooltip-header {
  padding: 12px 14px 10px;
  background: rgba(99,102,241,0.08);
  border-bottom: 1px solid rgba(99,102,241,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.info-tooltip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--indigo-400);
  letter-spacing: 0.02em;
  flex: 1;
}
.info-tooltip-close {
  width: 18px; height: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
  padding: 0;
}
.info-tooltip-close:hover { color: var(--text-primary); }

/* Tooltip body */
.info-tooltip-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Individual sections inside tooltip */
.tooltip-section {
  font-size: 12px;
  line-height: 1.55;
}
.tooltip-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.tooltip-section-text {
  color: var(--text-secondary);
}
.tooltip-section-text strong {
  color: var(--text-primary);
  font-weight: 600;
}
/* Formula or code-style section */
.tooltip-formula {
  background: rgba(15,21,38,0.7);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--indigo-400);
  line-height: 1.5;
}
/* Range indicator */
.tooltip-range {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tooltip-range-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.tooltip-range-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-good   { background: var(--emerald-400); }
.dot-ok     { background: var(--amber-400); }
.dot-bad    { background: var(--red-400); }
.dot-info   { background: var(--indigo-400); }
.dot-neutral{ background: var(--text-muted); }

/* Divider between sections */
.tooltip-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 2px 0;
}

/* Read more button inside tooltip */
.tooltip-readmore-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--indigo-400) !important;
  text-decoration: none;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  padding: 5px 12px;
  background: rgba(99, 102, 241, 0.05);
  transition: all 0.2s ease;
  cursor: pointer;
}
.tooltip-readmore-btn:hover {
  background: var(--indigo-500);
  color: #ffffff !important;
  border-color: var(--indigo-500);
  text-decoration: none;
}


/* Mobile responsiveness for tooltips */
@media (max-width: 640px) {
  .info-tooltip {
    width: calc(100vw - 24px);
    left: 12px !important;
    right: 12px !important;
  }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   RESEARCH HUB UTILITIES
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Surface aliases used by Research page inline styles */
:root {
  --surface-2: var(--bg-elevated);
  --surface-3: var(--bg-card-hover);
}

/* .page-header â€” flex row header used on all Research pages */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* .empty-state â€” zero-data placeholder */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 24px;
}
.empty-state h3 { color: var(--text-primary); margin-bottom: 8px; }

/* .data-table â€” styled table for Research pages */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-surface);
}
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { color: var(--text-secondary); }
.data-table thead th.num { text-align: right; }
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table td.num { text-align: right; }

/* Numeric cell alignment shortcut */
.num { text-align: right !important; }

/* Return colour helpers */
.text-success { color: var(--emerald-400) !important; }
.text-danger  { color: var(--red-400)     !important; }
.text-warning { color: var(--amber-400)   !important; }
.text-info    { color: var(--indigo-400)  !important; }

/* .chip / .chip-active group filter pills */
.chip {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.chip:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.chip.chip-active {
  background: var(--accent-glow);
  color: var(--indigo-400);
  border-color: var(--border-accent);
}


.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card-hover);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  font-family: monospace;
  cursor: help;
  margin-left: 4px;
  vertical-align: text-top;
}
.info-icon:hover {
  background: var(--indigo-500);
  color: #ffffff;
}

/* Signal Badges & Directional Values */
.market-val.msi-val-up { color: var(--emerald-400, #34d399); }
.market-val.msi-val-down { color: var(--red-400, #f87171); }
.msi-signal { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.2; }
.msi-signal-bullish, .msi-signal-excellent, .msi-signal-low-cost, .msi-signal-tight { background: rgba(52, 211, 153, 0.15); color: var(--emerald-400, #34d399); border: 1px solid rgba(52, 211, 153, 0.3); }
.msi-signal-bearish, .msi-signal-high-fee, .msi-signal-high-te { background: rgba(248, 113, 113, 0.15); color: var(--red-400, #f87171); border: 1px solid rgba(248, 113, 113, 0.3); }
.msi-signal-neutral, .msi-signal-defensive, .msi-signal-aggressive, .msi-signal-moderate, .msi-signal-dip, .msi-signal-caution { background: rgba(250, 204, 21, 0.15); color: var(--yellow-400, #facc15); border: 1px solid rgba(250, 204, 21, 0.3); }

/* ── Global Floating Share Widget ───────────────────────────── */
.global-share-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 990;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.global-share-fab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4), 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

.global-share-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.55), 0 4px 10px rgba(0,0,0,0.4);
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
}

.global-share-fab:active {
  transform: translateY(0) scale(0.98);
}

.share-fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Share Popup Card */
.global-share-modal {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: #0f172a;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(99, 102, 241, 0.15);
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.95);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  backdrop-filter: blur(20px);
}

.global-share-widget.open .global-share-modal {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.share-modal-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.share-modal-title {
  margin: 4px 0 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.share-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.share-modal-close:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

/* Page Context Box */
.share-context-preview {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.share-context-title {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-context-url {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Quick Copy Box */
.share-copy-box {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.share-link-input {
  flex: 1;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: #cbd5e1;
  outline: none;
  font-family: monospace;
}

.share-copy-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.share-copy-btn:hover {
  background: var(--indigo-400);
}

.share-copy-btn.copied {
  background: #10b981;
}

/* Grid of Share Targets */
.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.share-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}

.share-grid-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
  color: #ffffff;
}

.share-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-icon-whatsapp { background: rgba(37, 211, 102, 0.15); color: #25d366; }
.share-icon-linkedin { background: rgba(10, 102, 194, 0.15); color: #0a66c2; }
.share-icon-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); color: #ffffff; }
.share-icon-sms { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.share-icon-mail { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.share-icon-native { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

.share-item-label {
  font-size: 10.5px;
  font-weight: 500;
}

@media (max-width: 640px) {
  .global-share-widget {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: 16px;
  }
  .global-share-modal {
    right: 0;
    width: min(300px, calc(100vw - 32px));
  }
}

/* ── Topbar Watchlist Button ────────────────────────────────── */
.topbar-watchlist-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-watchlist-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.4);
}

.topbar-watchlist-btn.active {
  background: var(--accent-glow);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.5);
}

.topbar-watchlist-icon {
  font-size: 13px;
}

@media (max-width: 640px) {
  .topbar-watchlist-text {
    display: none;
  }
  .topbar-watchlist-btn {
    padding: 6px 8px;
  }
}

