@layer base {
  html, body { margin: 0; padding: 0; }
  body { overscroll-behavior: none; }
}

* { scrollbar-width: thin; scrollbar-color: var(--vsmi-color-border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--vsmi-color-border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--vsmi-color-text-muted); }

body {
  background: var(--vsmi-color-canvas);
  color: var(--vsmi-color-text);
  font-family: var(--vsmi-font-ui);
}

/*
 * Brand-token safety net.
 * The CDN runtime normally generates these utilities from tailwind.config.js.
 * Keeping the most visible semantic colors here prevents a monochrome UI when
 * a CDN/configuration race or a restrictive network policy delays generation.
 */
.text-primary, .text-secondary { color: var(--vsmi-color-primary) !important; }
.text-bullish, .text-bullish-bright { color: var(--vsmi-color-positive) !important; }
.text-bearish, .text-bearish-bright { color: var(--vsmi-color-negative) !important; }
.text-reference-amber { color: var(--vsmi-color-warning) !important; }
.text-volume-spike-neon { color: var(--vsmi-color-volume-signal) !important; }
.text-on-primary, .text-on-primary-container { color: var(--vsmi-color-on-primary) !important; }
.text-on-surface { color: var(--vsmi-color-text) !important; }
.text-on-surface-variant { color: var(--vsmi-color-text-muted) !important; }
.text-outline { color: var(--vsmi-color-outline) !important; }

.bg-primary, .bg-primary-container { background-color: var(--vsmi-color-primary) !important; }
.bg-bullish { background-color: var(--vsmi-color-positive) !important; }
.bg-bearish { background-color: var(--vsmi-color-negative) !important; }
.bg-reference-amber { background-color: var(--vsmi-color-warning) !important; }
.bg-volume-spike-neon { background-color: var(--vsmi-color-volume-signal) !important; }
.bg-canvas-dark { background-color: var(--vsmi-color-canvas) !important; }
.bg-surface-dark, .bg-panel-dark { background-color: var(--vsmi-color-surface) !important; }
.bg-surface-container { background-color: var(--vsmi-color-surface-high) !important; }
.bg-surface-container-low { background-color: var(--vsmi-color-surface-low) !important; }
.bg-surface-container-high { background-color: var(--vsmi-color-surface-high) !important; }
.bg-surface-container-highest { background-color: var(--vsmi-color-surface-highest) !important; }
.bg-surface-container-lowest { background-color: var(--vsmi-color-surface-lowest) !important; }
.border-border-dark { border-color: var(--vsmi-color-border) !important; }

[class~="bg-primary/10"] { background-color: color-mix(in srgb, var(--vsmi-color-primary) 10%, transparent) !important; }
[class~="bg-primary/20"] { background-color: color-mix(in srgb, var(--vsmi-color-primary) 20%, transparent) !important; }
[class~="bg-bullish/10"] { background-color: rgb(16 185 129 / 0.1) !important; }
[class~="bg-bullish/20"] { background-color: rgb(16 185 129 / 0.2) !important; }
[class~="bg-bearish/10"] { background-color: rgb(239 68 68 / 0.1) !important; }
[class~="bg-bearish/20"] { background-color: rgb(239 68 68 / 0.2) !important; }
[class~="bg-reference-amber/10"] { background-color: rgb(245 158 11 / 0.1) !important; }
[class~="bg-reference-amber/20"] { background-color: rgb(245 158 11 / 0.2) !important; }
[class~="bg-volume-spike-neon/10"] { background-color: rgb(192 132 252 / 0.1) !important; }
[class~="bg-volume-spike-neon/20"] { background-color: rgb(192 132 252 / 0.2) !important; }

/* Financial-terminal density without sacrificing regular readability. */
body .text-\[10px\], body .text-\[11px\] {
  font-size: 0.75rem !important;
  line-height: 1rem !important;
}

#vsmi-mobile-nav button { min-width: 48px; min-height: 44px; }

.vsmi-modal-section-title {
  margin: 12px 0 6px;
  color: var(--vsmi-color-text-muted);
  font: 600 0.75rem/1rem var(--vsmi-font-number);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.vsmi-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 39, 36, 0.36);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

header, footer, #vsmi-mobile-nav { box-shadow: 0 1px 10px rgba(32, 69, 64, .08) !important; }
html.dark header, html.dark footer, html.dark #vsmi-mobile-nav { box-shadow: 0 1px 10px rgba(0, 0, 0, .35) !important; }

.vsmi-modal-box {
  border-radius: var(--vsmi-radius-lg);
  width: 100%;
  max-width: 560px;
  background: var(--vsmi-color-surface);
  border: 1px solid var(--vsmi-color-border);
  color: var(--vsmi-color-text);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.vsmi-chart-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: var(--vsmi-color-canvas) !important;
}

.vsmi-workspace-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: var(--vsmi-color-canvas, #020617) !important;
}

.vsmi-focusable:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--vsmi-color-primary);
  outline-offset: 2px;
}

.vsmi-state {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--vsmi-space-4);
  border: 1px solid var(--vsmi-color-border);
  border-radius: var(--vsmi-radius-md);
  color: var(--vsmi-color-text-muted);
  text-align: center;
}

.vsmi-skeleton {
  border-radius: var(--vsmi-radius-sm);
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.15), transparent);
  background-size: 200% 100%;
  animation: vsmi-skeleton 1.2s linear infinite;
}

@keyframes vsmi-skeleton {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== SEARCHBOX (MÀU NỀN XÁM TRẮNG DỊU MẮT) ==================== */
#tech-chart-symbol-search,
#global-ticker-search,
#indicator-search-input,
.vsmi-search-input {
  background-color: #eef2f6 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#tech-chart-symbol-search::placeholder,
#global-ticker-search::placeholder,
#indicator-search-input::placeholder,
.vsmi-search-input::placeholder {
  color: #64748b !important;
}

#tech-chart-symbol-search:focus,
#global-ticker-search:focus,
#indicator-search-input:focus,
.vsmi-search-input:focus {
  background-color: #f8fafc !important;
  border-color: #04978b !important;
  box-shadow: 0 0 0 2px rgba(4, 151, 139, 0.2) !important;
}

html.dark #tech-chart-symbol-search,
html.dark #global-ticker-search,
html.dark #indicator-search-input,
html.dark .vsmi-search-input {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark #tech-chart-symbol-search::placeholder,
html.dark #global-ticker-search::placeholder,
html.dark #indicator-search-input::placeholder,
html.dark .vsmi-search-input::placeholder {
  color: #94a3b8 !important;
}

/* ==================== HEADER CHẾ ĐỘ SÁNG: NỀN #04978B, CHỮ TRẮNG & HIỆU ỨNG TAB ==================== */
html:not(.dark) #vsmi-primary-header {
  border-bottom-color: #037a71 !important;
}

html:not(.dark) #vsmi-primary-header-bar {
  background-color: #04978b !important;
  color: #ffffff !important;
}

html:not(.dark) #vsmi-brand-logo {
  color: #ffffff !important;
}

html:not(.dark) #vsmi-brand-badge {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

html:not(.dark) #vsmi-header-status-pill,
html:not(.dark) #vsmi-db-status-pill {
  background-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

html:not(.dark) #vsmi-header-status-pill span,
html:not(.dark) #vsmi-db-status-pill span {
  color: #ffffff !important;
}

/* Các tab điều hướng ở chế độ sáng (nền #04978b) */
html:not(.dark) #vsmi-main-nav .vsmi-nav-btn {
  color: rgba(255, 255, 255, 0.92) !important;
  background-color: transparent !important;
  font-weight: 500 !important;
  transition: all 0.18s ease !important;
}

html:not(.dark) #vsmi-main-nav .vsmi-nav-btn:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.18) !important;
}

/* Tab đang được chọn ở chế độ sáng: Nổi bật với nền trắng ngọc, chữ #04978b đậm và đổ bóng mịn */
html:not(.dark) #vsmi-main-nav .vsmi-nav-btn[aria-current="page"] {
  background-color: #ffffff !important;
  color: #04978b !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18) !important;
}

/* Các tab điều hướng ở chế độ tối */
html.dark #vsmi-main-nav .vsmi-nav-btn {
  color: #bcc9cd !important;
  background-color: transparent !important;
  font-weight: 500 !important;
  transition: all 0.18s ease !important;
}

html.dark #vsmi-main-nav .vsmi-nav-btn:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

html.dark #vsmi-main-nav .vsmi-nav-btn[aria-current="page"] {
  background-color: #2bbbad !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}

/* ==================== ĐIỀU HƯỚNG HEADER: ĐẢM BẢO LUÔN HIỂN THỊ TRÊN DESKTOP & TABLET ==================== */
@media (min-width: 768px) {
  #vsmi-main-nav {
    display: flex !important;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  #vsmi-main-nav::-webkit-scrollbar {
    display: none;
  }
  #vsmi-mobile-nav {
    display: none !important;
  }
}

/* Các nút công cụ bên phải Header ở chế độ sáng */
html:not(.dark) .vsmi-header-tool-btn {
  background-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

html:not(.dark) .vsmi-header-tool-btn:hover {
  background-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
}

html:not(.dark) #vsmi-user-avatar {
  background-color: #ffffff !important;
}

html:not(.dark) #vsmi-user-avatar span {
  color: #04978b !important;
}

/* ==================== ẨN TOÀN BỘ LOGO TRADINGVIEW TRÊN CÁC KHUNG BIỂU ĐỒ ==================== */
#vsmi-chart-widget #tv-attr-logo,
#vsmi-chart-widget a[href*="tradingview.com"],
#vsmi-chart-widget a[title*="TradingView"],
#tv-chart-canvas #tv-attr-logo,
#tv-chart-canvas a[href*="tradingview.com"],
#tv-chart-canvas a[title*="TradingView"],
#vsmi-psignal-wrapper #tv-attr-logo,
#vsmi-psignal-canvas #tv-attr-logo,
#vsmi-psignal-wrapper a[title*="TradingView"],
#vsmi-psignal-canvas a[title*="TradingView"],
#vsmi-vsignal-wrapper #tv-attr-logo,
#vsmi-vsignal-canvas #tv-attr-logo,
#vsmi-vsignal-wrapper a[title*="TradingView"],
#vsmi-vsignal-canvas a[title*="TradingView"],
.tv-attr-logo,
a#tv-attr-logo {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* ==================== SUB-PANE INDICATOR LEGEND BADGE (THEME RESPONSIVE) ==================== */
.vsmi-subpane-legend {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  font-family: var(--vsmi-font-ui), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  line-height: 1.2 !important;
  background-color: rgba(255, 255, 255, 0.96) !important;
  color: #0f172a !important;
  border: 1px solid rgba(207, 221, 219, 0.9) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: auto !important;
  user-select: none !important;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

html.dark .vsmi-subpane-legend {
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(51, 65, 85, 0.8) !important;
  box-shadow: none !important;
}

.vsmi-subpane-legend .indicator-title {
  color: #0f172a !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
}

html.dark .vsmi-subpane-legend .indicator-title {
  color: #f1f5f9 !important;
}

/* Nút tùy chỉnh (⚙) và nút đóng (✕) */
.vsmi-subpane-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1px 3px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  color: #64748b !important;
  opacity: 0.8 !important;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease !important;
  pointer-events: auto !important;
}

html.dark .vsmi-subpane-btn {
  color: #94a3b8 !important;
}

.vsmi-subpane-btn:hover {
  opacity: 1 !important;
  color: #04978b !important;
  background-color: rgba(4, 151, 139, 0.12) !important;
}

html.dark .vsmi-subpane-btn:hover {
  color: #2bbbad !important;
  background-color: rgba(43, 187, 173, 0.22) !important;
}

.vsmi-subpane-btn.btn-close:hover {
  color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.14) !important;
}

