/*
  Anantys Portal (clean baseline)
  - No gradients
  - No glow
  - No strong shadows
  - Bloomberg-like readability with restrained accents

  Scope:
  - Only affects pages that include this stylesheet
  - Rules are scoped under `body.portal` to avoid impacting the navbar web component
*/

body.portal {
  /* Typography */
  --ap-font-body: "Inter", system-ui, -apple-system, "Segoe UI", Arial,
    sans-serif;
  --ap-font-title: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Arial,
    sans-serif;
  --ap-font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;

  /* Neutrals (dark) */
  --ap-bg: #0b0f14;
  --ap-surface-1: #0f1620;
  --ap-surface-2: #141d29;
  --ap-border: rgba(255, 255, 255, 0.1);

  /* Text */
  --ap-text: rgba(255, 255, 255, 0.92);
  --ap-text-secondary: rgba(255, 255, 255, 0.72);
  --ap-text-muted: rgba(255, 255, 255, 0.58);

  /* Accent (emerald) */
  --ap-accent: #2fbf89; /* subtle emerald */
  --ap-accent-hover: #3fd39a;

  /* Semantic */
  --ap-success: #2fbf89;
  --ap-danger: #d2645a;
  --ap-warning: #d0a24a;
  --ap-info: #76b9c8;

  /* Bootstrap variable mapping (keep Bootstrap as layout/utility layer) */
  --bs-body-bg: var(--ap-bg);
  --bs-body-color: var(--ap-text);

  --bs-border-color: var(--ap-border);
  --bs-border-color-translucent: var(--ap-border);
  --bs-border-color-rgb: 255, 255, 255;

  --bs-primary: var(--ap-accent);
  --bs-link-color: var(--ap-accent);
  --bs-link-hover-color: var(--ap-accent-hover);

  --bs-secondary: var(--ap-surface-1);
  --bs-secondary-color: var(--ap-text-secondary);

  --bs-success: var(--ap-success);
  --bs-danger: var(--ap-danger);
  --bs-warning: var(--ap-warning);
  --bs-info: var(--ap-info);

  /* Remove shadow as a design motif */
  --bs-box-shadow: none;
  --bs-box-shadow-sm: none;
  --bs-box-shadow-lg: none;
}

/* Layout: move sticky footer rules out of template */
body.portal {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.portal main {
  flex: 1 0 auto;
  position: relative;
}

body.portal .footer {
  background-color: var(--bs-secondary);
  border-top: 1px solid rgba(var(--bs-border-color-rgb), 0.1);
}

/* Footer: quiet, newsroom-like */
body.portal .ap-footer {
  background-color: transparent !important;
  color: var(--ap-text-muted) !important;
  font-size: 0.9rem;
}

body.portal .ap-footer a {
  color: var(--ap-text-secondary);
  text-decoration: none;
}

body.portal .ap-footer a:hover {
  color: var(--ap-text);
  text-decoration: underline;
}
body.portal,
body.portal * {
  font-family: var(--ap-font-body);
}

body.portal h1,
body.portal h2,
body.portal h3,
body.portal h4,
body.portal h5,
body.portal h6 {
  font-family: var(--ap-font-title);
  letter-spacing: -0.01em;
}

/* Opt-in mono for tickers / numbers */
body.portal .ap-mono,
body.portal .mono,
body.portal .ticker,
body.portal code,
body.portal pre {
  font-family: var(--ap-font-mono);
}

/* Ban gradients (without breaking icon background-images like `.btn-close`) */
body.portal {
  background-image: none;
}

body.portal .bg-gradient {
  background-image: none !important;
}

/* Flatten Bootstrap shadows (templates may still use `shadow-*`) */
body.portal .shadow,
body.portal .shadow-sm,
body.portal .shadow-lg {
  box-shadow: none !important;
}

/* Panels > cards: keep structure with borders/surfaces */
body.portal .card {
  background-color: var(--ap-surface-1);
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  box-shadow: none !important;
}

body.portal .card .card-header {
  background-color: transparent;
  border-bottom: 1px solid var(--ap-border);
}

/* Simple panel pattern (flat, border-based) */
body.portal .ap-panel {
  background-color: var(--ap-surface-1);
  border: 1px solid var(--ap-border);
  border-radius: 10px;
}

body.portal .ap-panel-body {
  padding: 1rem;
}

/* Small brand mark used in headers */
body.portal .ap-brand-mark {
  width: 48px !important;
  height: 48px !important;
}

/* Buttons: keep crisp, avoid glossy effects */
body.portal .btn {
  box-shadow: none !important;
}

body.portal .btn-primary {
  background-color: var(--ap-accent);
  border-color: var(--ap-accent);
  color: #0b0f14;
}

body.portal .btn-primary:hover,
body.portal .btn-primary:focus {
  background-color: var(--ap-accent-hover);
  border-color: var(--ap-accent-hover);
  color: #0b0f14;
}

/* Tooltips: no shadow, use border + surface */
body.portal .tooltip .tooltip-inner {
  background-color: var(--ap-surface-2) !important;
  color: var(--ap-text) !important;
  border: 1px solid var(--ap-border);
  box-shadow: none !important;
}

/* Modals/menus: remove elevation-heavy look */
body.portal .modal-content,
body.portal .dropdown-menu,
body.portal .offcanvas {
  box-shadow: none !important;
  border: 1px solid var(--ap-border);
  background-color: var(--ap-surface-1);
  color: var(--ap-text);
}

/* Progress bars: solid only */
body.portal .progress {
  background-color: rgba(255, 255, 255, 0.06);
}

body.portal .progress-bar {
  background-color: var(--ap-accent) !important;
  background-image: none !important;
}

/* Tables: readable, newsroom-like */
body.portal .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ap-text);
  --bs-table-border-color: var(--ap-border);
}

body.portal .text-muted {
  color: var(--ap-text-muted) !important;
}

body.portal .text-secondary {
  color: var(--ap-text-secondary) !important;
}

body.portal .bg-dark {
  background-color: var(--ap-surface-1) !important;
}

/* Landing/search page primitives */
body.portal .ap-hero {
  padding: 2.75rem 0 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

body.portal .ap-page-title {
  margin: 0.5rem 0 0;
  font-size: 1.5rem;
  line-height: 1.2;
  text-align: center;
}

@media (min-width: 992px) {
  body.portal .ap-page-title {
    font-size: 1.75rem;
  }
}

body.portal .ap-page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--ap-text-secondary);
  font-size: 0.95rem;
  text-align: center;
}

/* Center the landing search as primary focal point */
body.portal .ap-search-form {
  margin: 0 auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  width: 100%;
  max-width: 720px;
}

body.portal .search-section .container {
  display: flex;
  justify-content: center;
}

body.portal .search-box {
  width: 100%;
  padding: 1rem 1.1rem;
  border-radius: 12px !important;
  border: 1px solid var(--ap-border) !important;
  background-color: var(--ap-surface-2) !important;
  color: var(--ap-text) !important;
  font-size: 1.05rem !important;
  max-width: 720px !important;
  text-align: left !important;
  outline: none;
}

body.portal .search-box::placeholder {
  color: var(--ap-text-muted);
}

body.portal .search-box:focus {
  border-color: rgba(47, 191, 137, 0.55) !important;
  box-shadow: none !important;
}

body.portal .search-section {
  margin: 0.75rem 0 2.25rem !important;
  min-height: unset !important;
  display: block !important;
  text-align: center !important;
}

body.portal #landing-suggestions.datalist-autocomplete.dropdown-menu {
  border: 1px solid var(--ap-border);
  background-color: var(--ap-surface-1);
  box-shadow: none !important;
  padding: 0.25rem;
  border-radius: 10px !important;
}

body.portal .datalist-autocomplete.dropdown-menu .dropdown-item {
  border-radius: 8px;
  color: var(--ap-text);
}

body.portal .datalist-autocomplete.dropdown-menu .dropdown-item:hover,
body.portal .datalist-autocomplete.dropdown-menu .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.06);
}

/* Make legacy “outline-light” behave like a neutral outline */
body.portal .btn-outline-light {
  color: var(--ap-text) !important;
  border-color: var(--ap-border) !important;
}

body.portal .btn-outline-light:hover,
body.portal .btn-outline-light:focus {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border-color: var(--ap-border) !important;
  color: var(--ap-text) !important;
}

body.portal .ap-section-title {
  font-family: var(--ap-font-title);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ap-text-secondary);
}

body.portal .ap-page-title {
  display: block !important;
  color: var(--ap-text) !important;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Flatten “news cards” (remove gradients/always-on effects/shadows) */
body.portal .news-card,
body.portal .news-card * {
  box-shadow: none !important;
  transform: none !important;
  text-shadow: none !important;
}

body.portal .news-card {
  border-radius: 10px !important;
  border: 1px solid var(--ap-border) !important;
  background-color: var(--ap-surface-1) !important;
  cursor: pointer;
}

body.portal .news-card-header {
  min-height: 132px;
  border-bottom: 1px solid var(--ap-border);
}

body.portal .news-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Solid overlay (not a gradient) for title legibility on images */
body.portal .news-card-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

body.portal .news-card-title-wrapper {
  position: relative;
  z-index: 1;
  padding: 0.9rem 1rem 0.95rem 1rem;
}

body.portal .news-card-title {
  font-family: var(--ap-font-title);
  font-size: 1.05rem;
  line-height: 1.35;
}

body.portal .news-card.news-card-lg .news-card-title {
  font-size: 1.25rem;
}

body.portal .news-card-body {
  padding: 1rem !important;
}

body.portal .news-card .excerpt {
  color: var(--ap-text-secondary) !important;
  font-size: 0.95rem;
  line-height: 1.55;
}

body.portal .news-card-tag {
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(255, 255, 255, 0.06) !important;
  color: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  z-index: 2;
}

body.portal .news-card-meta {
  border-top-color: var(--ap-border) !important;
}

body.portal .news-card-title-wrapper {
  padding-top: 2.1rem;
}

body.portal .news-card-stockmark img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

body.portal .ap-badge {
  border-radius: 999px;
  border: 1px solid var(--ap-border);
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

body.portal .ap-badge-ticker {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--ap-text-secondary);
}

/* Editorial header alignment + CTA style */
body.portal .search-editorial-section {
  margin-top: 2.75rem !important;
}

body.portal .search-editorial-header {
  align-items: center;
}

body.portal .search-editorial-header .btn {
  border-radius: 999px;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

body.portal .search-editorial-header .btn-outline-light {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Sector panel + pills (size/padding/typography) */
body.portal .search-sector-panel {
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  padding: 1rem;
  background-color: var(--ap-surface-1);
}

body.portal .search-sector-panel .text-uppercase {
  letter-spacing: 0.08em;
}

body.portal .search-sector-pills {
  gap: 0.6rem !important;
}

body.portal .search-sector-pill {
  display: inline-flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ap-text) !important;
  min-width: 140px;
}

body.portal .search-sector-pill .sector-pill-label {
  font-size: 0.9rem;
  font-weight: 600;
}

body.portal .search-sector-pill .pill-variation {
  font-size: 0.9rem;
  font-weight: 650;
}

body.portal .btn-outline-secondary {
  color: var(--ap-text) !important;
  border-color: var(--ap-border) !important;
}

body.portal .btn-outline-secondary:hover,
body.portal .btn-outline-secondary:focus {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: var(--ap-text) !important;
  border-color: var(--ap-border) !important;
}

body.portal .news-card::before,
body.portal .news-card-overlay,
body.portal .news-card-glass,
body.portal .news-card-glass::after {
  display: none !important;
  content: none !important;
}

body.portal .news-card-bg,
body.portal .news-card .news-card-bg,
body.portal .news-card .news-img-wrapper img {
  transform: none !important;
  filter: none !important;
}

body.portal .news-card-title {
  text-shadow: none !important;
}

/* Sector pills: flat, border-led */
body.portal .search-sector-pill {
  border: 1px solid var(--ap-border) !important;
  background-color: var(--ap-surface-1) !important;
  box-shadow: none !important;
}

body.portal .search-sector-pill.is-pos .pill-variation {
  color: var(--ap-success) !important;
}

body.portal .search-sector-pill.is-neg .pill-variation {
  color: var(--ap-danger) !important;
}

/* Market trends: remove gradients/glows/shadows */
body.portal .market-trends {
  background: var(--ap-bg) !important;
  background-image: none !important;
}

body.portal .market-trends .css-web-card {
  border-radius: 10px !important;
  border: 1px solid var(--ap-border) !important;
  background: var(--ap-surface-1) !important;
  background-image: none !important;
  box-shadow: none !important;
  color: var(--ap-text) !important;
}

body.portal .market-trends .market-widget-dot--up,
body.portal .market-trends .market-widget-dot--down,
body.portal .market-trends .market-widget-dot--momentum {
  box-shadow: none !important;
}

/* Newsletter/CTA sections: keep flat and readable */
body.portal .newsletter-highlight,
body.portal .invest-cta {
  background: transparent !important;
  background-image: none !important;
}

/* Newsletter block: flat, elegant, readable */
body.portal .ap-newsletter {
  border: 1px solid var(--ap-border);
  background-color: var(--ap-surface-1);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  body.portal .ap-newsletter {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
}

body.portal .ap-newsletter-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ap-text-muted);
}

body.portal .ap-newsletter-title {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.2rem;
}

body.portal .ap-newsletter-meta {
  font-size: 0.85rem;
  color: var(--ap-text-muted);
}

body.portal .ap-newsletter-excerpt {
  margin-top: 0.75rem;
  color: var(--ap-text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
}

body.portal .ap-newsletter-excerpt p {
  margin: 0 0 0.65rem 0;
}

body.portal .ap-newsletter-excerpt p:last-child {
  margin-bottom: 0;
}

body.portal .ap-newsletter-actions .btn {
  width: 100%;
}

@media (min-width: 768px) {
  body.portal .ap-newsletter-actions .btn {
    width: auto;
    white-space: nowrap;
  }
}

/* ---------------------------------------------
   Stock page (align with /search + guidelines)
   - flat panels, hairline borders
   - consistent spacing scale
   - no glows, no gradients, no heavy headers
---------------------------------------------- */

body.portal .ap-panel-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

body.portal .ap-panel-title {
  margin: 0;
  font-family: var(--ap-font-title);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ap-text-secondary);
}

body.portal .ap-panel-subtitle {
  margin: 0;
  color: var(--ap-text-muted);
  font-size: 0.9rem;
}

/* Stock header */
body.portal .stock-header {
  padding-bottom: 1rem;
}

body.portal .stock-header .stock-description p {
  line-height: 1.6;
  max-width: 72ch;
}

body.portal .stock-header .hero-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

@media (min-width: 992px) {
  body.portal .stock-header .hero-title {
    font-size: 1.9rem;
  }
}

body.portal .stock-header .subtitle {
  font-size: 0.95rem;
  color: var(--ap-text-secondary) !important;
  font-weight: 500;
}

body.portal .ticker-badge,
body.portal .badge-metadata,
body.portal .badge-small {
  border-radius: 999px;
  border: 1px solid var(--ap-border);
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--ap-text-secondary);
}

/* Outline pill with "primary" border (used for portfolio badges + ticker under logo) */
body.portal .badge-portfolio {
  border-radius: 999px;
  border: 1px solid var(--bs-primary);
  background-color: rgba(47, 191, 137, 0.08);
  color: var(--ap-text);
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.1;
  font-weight: 650;
}

body.portal a .badge-portfolio:hover {
  background-color: rgba(47, 191, 137, 0.12);
}

body.portal .badge-small {
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

body.portal .badge-metadata {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}

body.portal .badge-metadata i {
  opacity: 0.85;
}

/* Chart panel */
body.portal .stock-chart-container {
  border: 1px solid var(--ap-border);
  background-color: var(--ap-surface-1);
  border-radius: 12px;
  padding: 0.9rem;
}

body.portal .stock-chart-container .chart-wrapper {
  min-height: 380px;
}

@media (max-width: 768px) {
  body.portal .stock-chart-container .chart-wrapper {
    min-height: 300px;
  }
}

body.portal .stock-chart-container .chart-header {
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}

body.portal .stock-chart-container .chart-title h5,
body.portal .stock-chart-container .chart-title h6 {
  margin: 0;
  font-family: var(--ap-font-title);
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--ap-text-secondary) !important;
}

body.portal .stock-chart-container .time-scale-group .btn,
body.portal .stock-chart-container .time-scale-group-mobile .btn {
  border-radius: 10px !important;
  border: 1px solid var(--ap-border) !important;
  color: var(--ap-text) !important;
  background: rgba(255, 255, 255, 0.02) !important;
  padding: 0.25rem 0.5rem;
  font-weight: 600;
}

body.portal .stock-chart-container .time-scale-group .btn.active,
body.portal .stock-chart-container .time-scale-group-mobile .btn.active {
  background: rgba(47, 191, 137, 0.14) !important;
  border-color: rgba(47, 191, 137, 0.45) !important;
  color: var(--ap-text) !important;
}

body.portal .stock-chart-container select.form-select {
  border-radius: 10px;
  border: 1px solid var(--ap-border);
  background-color: var(--ap-surface-2);
  color: var(--ap-text);
  font-weight: 600;
}

/* Performance + Momentum panel */
body.portal .performance-card {
  background: var(--ap-surface-1) !important;
  border: 1px solid var(--ap-border) !important;
  border-radius: 12px !important;
}

body.portal .performance-card .card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--ap-border) !important;
  color: var(--ap-text) !important;
}

/* New: single flat panel variant (stock momentum right column) */
body.portal .ap-performance-panel .ap-panel-body {
  padding: 1rem;
}

body.portal .ap-performance-panel .ap-user-performance {
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background-color: rgba(255, 255, 255, 0.02);
}

body.portal .ap-performance-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 768px) {
  body.portal .ap-performance-grid {
    grid-template-columns: 1fr 160px;
  }
}

body.portal .ap-past-performance .perf-row {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

body.portal .ap-momentum .momentum-badge {
  margin-left: auto;
}

/* Momentum: centered badge, border color driven inline (score->red/green) */
body.portal .ap-momentum {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

body.portal .ap-momentum > .d-flex:first-child {
  width: 100%;
}

body.portal .ap-momentum .momentum-badge {
  margin-left: 0;
}

body.portal .performance-card .perf-row {
  background: transparent !important;
  border: 0;
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
}

body.portal .performance-card .perf-label {
  color: var(--ap-text-muted) !important;
  font-weight: 650;
}

body.portal .performance-card .perf-value {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--ap-font-mono);
  font-weight: 650;
}

body.portal .performance-card .perf-value .text-success {
  color: var(--ap-success) !important;
}

body.portal .performance-card .perf-value .text-danger {
  color: var(--ap-danger) !important;
}

/* Similar stocks mini cards */
body.portal .stock-mini-card.ap-panel {
  padding: 1rem !important;
}

body.portal .stock-mini-card .mini-chart-container canvas {
  opacity: 0.95;
}

body.portal .stock-mini-card h5 {
  font-family: var(--ap-font-title);
}

/* Momentum: neutral, no glow */
body.portal .momentum-indicator {
  margin-left: 0;
  min-width: 128px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

body.portal .momentum-badge {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none !important;
  text-shadow: none !important;
}

body.portal .momentum-score {
  font-family: var(--ap-font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ap-text);
  text-shadow: none !important;
}

body.portal .momentum-title {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ap-text-secondary);
}

body.portal .momentum-bar {
  height: 6px !important;
  border-radius: 999px !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
}

/* Ensure momentum classes are restrained (in case filters output them) */
body.portal .momentum-critical,
body.portal .momentum-verylow,
body.portal .momentum-low,
body.portal .momentum-moderate,
body.portal .momentum-neutral,
body.portal .momentum-positive,
body.portal .momentum-strong,
body.portal .momentum-exceptional {
  box-shadow: none !important;
  text-shadow: none !important;
}

body.portal .momentum-positive,
body.portal .momentum-strong,
body.portal .momentum-exceptional {
  background-color: rgba(47, 191, 137, 0.22) !important;
}

body.portal .momentum-neutral,
body.portal .momentum-moderate {
  background-color: rgba(208, 162, 74, 0.22) !important;
}

body.portal .momentum-low,
body.portal .momentum-verylow,
body.portal .momentum-critical {
  background-color: rgba(210, 100, 90, 0.22) !important;
}

/* ---------------------------------------------
   Autocomplete (opaque dropdown, portal tokens)
---------------------------------------------- */

/* When the navbar uses Shadow DOM, the dropdown is appended to `document.body`.
   Keep this rule unscoped (no `body.portal`) so it always applies. */
#landing-suggestions.datalist-autocomplete.dropdown-menu {
  border: 1px solid var(--ap-border, rgba(255, 255, 255, 0.1));
  background: var(--ap-surface-1, #0f1620) !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  padding: 0.25rem;
  border-radius: 10px !important;
  z-index: 2200;
  max-height: min(520px, 60vh);
  overflow: auto;
}

#landing-suggestions.datalist-autocomplete.dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--ap-text, rgba(255, 255, 255, 0.92));
  background: transparent;
  border-radius: 8px;
  white-space: normal;
}

#landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item
  > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

#landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item
  > span:last-child {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ap-text-secondary, rgba(255, 255, 255, 0.72));
  font-family: var(--ap-font-mono, ui-monospace);
  font-variant-numeric: tabular-nums;
}

#landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item
  .highlight {
  color: var(--ap-accent, #2fbf89);
  font-weight: 650;
}

#landing-suggestions.datalist-autocomplete.dropdown-menu .dropdown-item.active,
#landing-suggestions.datalist-autocomplete.dropdown-menu .dropdown-item:hover,
#landing-suggestions.datalist-autocomplete.dropdown-menu .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.06);
}

body.portal #landing-suggestions.datalist-autocomplete.dropdown-menu {
  background: var(--ap-surface-1) !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 1100;
  max-height: min(520px, 60vh);
  overflow: auto;
}

body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--ap-text);
  background: transparent;
  white-space: normal;
}

body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item
  > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item
  > span:last-child {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ap-text-secondary);
  font-family: var(--ap-font-mono);
  font-variant-numeric: tabular-nums;
}

body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item
  .highlight {
  color: var(--ap-accent);
  font-weight: 650;
}

body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item.active,
body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item:hover,
body.portal
  #landing-suggestions.datalist-autocomplete.dropdown-menu
  .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.06);
}

/* ---------------------------------------------
   Stock page: Community block (flat, readable)
---------------------------------------------- */

body.portal .community-engagement-section .community-engagement-card {
  background-color: var(--ap-surface-1);
}

body.portal .community-engagement-section .community-engagement-body {
  padding: 1rem 1.25rem;
}

body.portal .community-engagement-section .community-engagement-header-label {
  letter-spacing: 0.1em;
}

body.portal .community-engagement-section .community-engagement-logo {
  width: 64px;
  height: 64px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ap-border);
  color: var(--ap-text);
}

body.portal .community-engagement-section .community-engagement-copy .lead {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ap-text-secondary) !important;
}

body.portal .community-engagement-section .community-engagement-kpi {
  background: transparent;
  border: 1px solid var(--ap-border);
  border-radius: 10px;
  padding: 0.8rem 0.9rem !important;
}

body.portal .community-engagement-section .community-engagement-kpi-title {
  letter-spacing: 0.08em;
}

body.portal .community-engagement-section .community-engagement-kpi-value {
  font-family: var(--ap-font-mono);
  font-variant-numeric: tabular-nums;
}

/* Community: right column KPI "buttons" (2x2 grid) */
body.portal .community-engagement-section .community-engagement-kpis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-content: start;
}

body.portal .community-engagement-section .community-engagement-kpi-btn {
  width: 100%;
  padding: 0.8rem 0.9rem !important;
  background-color: rgba(255, 255, 255, 0.02);
  cursor: default;
}

body.portal .community-engagement-section .community-engagement-kpi-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

body.portal
  .community-engagement-section
  .community-engagement-kpi-btn
  .community-engagement-kpi-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--ap-text-muted);
  margin-bottom: 0.25rem;
}

body.portal
  .community-engagement-section
  .community-engagement-kpi-btn
  .community-engagement-kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ap-text);
}

/* ---------------------------------------------
   Stock page: YouTube block (neutral, no blue)
---------------------------------------------- */

body.portal .stock-video .ap-panel {
  overflow: hidden;
}

body.portal .stock-video .stock-video-copy {
  padding: 1.1rem !important;
}

@media (min-width: 768px) {
  body.portal .stock-video .stock-video-copy {
    padding: 1.5rem !important;
  }
}

body.portal .stock-video .stock-video-copy h2 {
  line-height: 1.25;
}

body.portal .stock-video .stock-video-actions .btn {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
}

@media (min-width: 768px) {
  body.portal .stock-video .stock-video-actions .btn {
    width: auto;
  }
}

body.portal .stock-video .stock-video-embed {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

@media (min-width: 768px) {
  body.portal .stock-video .row > .col-md-6:first-child {
    border-right: 1px solid var(--ap-border);
  }
}

body.portal .stock-video .stock-video-copy p {
  color: var(--ap-text-secondary) !important;
}

/* ---------------------------------------------
   Stock page: News blocks (clean newsroom rows)
---------------------------------------------- */

body.portal .featured-news .insight-img {
  object-fit: cover;
  border-right: 1px solid var(--ap-border);
}

@media (max-width: 767.98px) {
  body.portal .featured-news .insight-img {
    border-right: 0;
    border-bottom: 1px solid var(--ap-border);
  }
}

body.portal .stock-insights .ap-panel-body {
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

body.portal .stock-insights .insight-item {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
  border-color: var(--ap-border) !important;
}

body.portal .stock-insights .insight-item h6 {
  font-family: var(--ap-font-title);
  font-weight: 650 !important;
  color: var(--ap-text);
  line-height: 1.35;
}

body.portal .stock-insights .insight-analysis {
  color: var(--ap-text-secondary) !important;
  line-height: 1.55;
}

body.portal .stock-insights .news-thumbnail {
  width: 220px;
  height: 138px;
  object-fit: cover;
  border-radius: 10px !important;
  border: 1px solid var(--ap-border);
  background-color: rgba(255, 255, 255, 0.03);
}

@media (max-width: 767.98px) {
  body.portal .stock-insights .news-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}
