    #widget-grid {
        position: relative;
        background-image: 
            repeating-linear-gradient(0deg, transparent, transparent 214px, #e0e0e0 214px, #e0e0e0 215px),
            repeating-linear-gradient(90deg, transparent, transparent 214px, #e0e0e0 214px, #e0e0e0 215px);
        background-size: 215px 215px;
        min-height: 1290px; /* 6 rows */
        width: 2150px; /* 10 columns */
        margin: 0 auto; /* Center the grid */
        padding: 0;
        border-left: 1px solid #e0e0e0; /* Add left border to complete the grid */
        border-right: 1px solid #e0e0e0; /* Add right border to complete the grid */
    }
    .empty-cell-btn {
        text-decoration: none;
        z-index: 5;
    }
    .empty-cell-btn .add-circle {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.06);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s;
        color: #bbb;
        font-size: 1.6rem;
        line-height: 1;
        padding-bottom: 2px;
        user-select: none;
    }
    .empty-cell-btn:hover .add-circle {
        background-color: rgba(0, 0, 0, 0.15);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transform: translate(-50%, -50%) scale(1.1);
        color: #555;
    }
    .empty-cell-btn:active .add-circle {
        transform: translate(-50%, -50%) scale(0.92);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    .widget {
        position: absolute;
        cursor: move;
        transition: box-shadow 0.2s;
        z-index: 10;
    }
    .widget:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        z-index: 20;
    }
    .widget.dragging {
        opacity: 0.7;
        z-index: 100;
    }
    /* Grid-based sizing and positioning */
    .widget .card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    .card-header {
        padding: 0.25rem 0.5rem;
        background-color: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
        flex-shrink: 0;
        min-height: auto;
    }
    .card-header h6 {
        font-size: 0.75rem;
        font-weight: 600;
        color: #495057;
    }
    .card-body {
        padding: 0.5rem;
        overflow-y: auto;
        flex-grow: 1;
    }
    /* Ensure loading SVGs display properly in widgets */
    .card-body .text-center.py-4 .svg-global {
        overflow: visible !important;
        position: relative;
        z-index: 1;
    }
    .stock-item {
        border-bottom: 1px solid #eee;
        padding: 4px 0;
        font-size: 0.75rem;
    }
    .stock-item:last-child {
        border-bottom: none;
    }
    /* Compact styling for market index items */
    .market-index-item {
        border-bottom: 1px solid #eee;
        padding: 1px 0;
        font-size: 0.7rem;
    }
    .market-index-item:last-child {
        border-bottom: none;
    }
    .market-index-item .h6 {
        font-size: 0.7rem;
        margin-bottom: 0;
    }
    .market-index-item small {
        font-size: 0.65rem;
    }
    .news-item {
        border-left: 2px solid #007bff;
        padding-left: 8px;
        margin-bottom: 8px;
        font-size: 0.7rem;
    }
    .news-item h6 {
        font-size: 0.75rem;
        margin-bottom: 0.15rem;
    }
    .drag-handle {
        cursor: grab;
        padding: 0 4px;
        color: #999;
        font-size: 1rem;
        line-height: 1;
    }
    .drag-handle:active {
        cursor: grabbing;
    }
    /* Stock tracker compact layout */
    .stock-tracker-compact {
        text-align: center;
        font-size: 0.7rem;
    }
    .stock-tracker-compact .symbol {
        font-size: 0.9rem;
        font-weight: bold;
        margin-bottom: 0.25rem;
    }
    .stock-tracker-compact .price {
        font-size: 1.2rem;
        font-weight: bold;
        margin: 0.25rem 0;
    }
    .stock-tracker-compact .change {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    .stock-tracker-compact .metrics {
        font-size: 0.65rem;
        margin-top: 0.25rem;
    }
    .stock-tracker-compact .metric-row {
        display: flex;
        justify-content: space-between;
        padding: 2px 0;
        border-top: 1px solid #eee;
    }
    .stock-tracker-compact .metric-label {
        color: #6c757d;
    }
    .stock-tracker-compact hr {
        margin: 0.25rem 0;
    }
    .grid-overlay {
        position: absolute;
        border: 2px dashed #007bff;
        background: rgba(0, 123, 255, 0.1);
        pointer-events: none;
        z-index: 5;
        display: none;
    }
    /* Performance-based color coding */
    .widget .card {
        transition: background-color 0.3s ease;
    }
    .widget-performance-bg {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        opacity: 0.15;
        pointer-events: none;
        border-radius: 0.25rem;
    }
    /* Mini chart for larger widgets */
    .mini-chart {
        width: 100%;
        height: 100px;
        margin: 0.5rem 0;
    }
    .stock-chart-container {
        width: 100%;
        height: 150px;
        margin-top: 0.5rem;
    }
    .market-index-chart-container {
        width: 100%;
        height: 100px;
        margin-top: 0.125rem;
        margin-bottom: 0.15rem;
    }
    /* Stock Detail Modal Styles */
    .stock-detail-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        margin-bottom: 2rem;
    }
    .stock-detail-cell {
        background-color: #f8f9fa;
        padding: 0.25rem;
        border-radius: 0.5rem;
        text-align: center;
        border: 1px solid #dee2e6;
    }
    .stock-detail-cell h6 {
        color: #6c757d;
        margin-bottom: 0.1rem;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .change-large {
        font-size: 1.1rem;
        font-weight: 600;
    }
    .price-display {
        font-size: 1.2rem;
        font-weight: 600;
        line-height: 1.2;
    }
    .chart-cell {
        grid-column: span 3;
    }
    .stock-detail-chart-container {
        width: 100%;
        height: 200px;
        margin-top: 1rem;
    }
    .detail-chart {
        width: 100% !important;
        height: 100% !important;
    }

/* From Uiverse.io by AqFox */
.spinner {
 width: 32px;
 height: 32px;
 animation: spinner-y0fdc1 2s infinite ease;
 transform-style: preserve-3d;
 margin: 0 auto;
 display: block;
}

.spinner > div {
 background-color: rgba(0,77,255,0.2);
 height: 100%;
 position: absolute;
 width: 100%;
 border: 2px solid #004dff;
}

.spinner div:nth-of-type(1) {
 transform: translateZ(-16px) rotateY(180deg);
}

.spinner div:nth-of-type(2) {
 transform: rotateY(-270deg) translateX(50%);
 transform-origin: top right;
}

.spinner div:nth-of-type(3) {
 transform: rotateY(270deg) translateX(-50%);
 transform-origin: center left;
}

.spinner div:nth-of-type(4) {
 transform: rotateX(90deg) translateY(-50%);
 transform-origin: top center;
}

.spinner div:nth-of-type(5) {
 transform: rotateX(-90deg) translateY(50%);
 transform-origin: bottom center;
}

.spinner div:nth-of-type(6) {
 transform: translateZ(16px);
}

@keyframes spinner-y0fdc1 {
 0% {
  transform: rotate(45deg) rotateX(-25deg) rotateY(25deg);
 }

 50% {
  transform: rotate(45deg) rotateX(-385deg) rotateY(25deg);
 }

 100% {
  transform: rotate(45deg) rotateX(-385deg) rotateY(385deg);
 }
}

/* From Uiverse.io by Juanes200122 */
/* From Uiverse.io by Juanes200122 */
.svg-global {
  zoom: 1.1;
  overflow: visible;
  max-width: 100%;
  height: auto;
}

@keyframes fade-particles {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(-40px);
    opacity: 0;
  }
}

#particles {
  animation: fade-particles 5s infinite alternate;
}
.particle {
  animation: floatUp linear infinite;
}

.p1 {
  animation-duration: 2.2s;
  animation-delay: 0s;
}
.p2 {
  animation-duration: 2.5s;
  animation-delay: 0.3s;
}
.p3 {
  animation-duration: 2s;
  animation-delay: 0.6s;
}
.p4 {
  animation-duration: 2.8s;
  animation-delay: 0.2s;
}
.p5 {
  animation-duration: 2.3s;
  animation-delay: 0.4s;
}
.p6 {
  animation-duration: 3s;
  animation-delay: 0.1s;
}
.p7 {
  animation-duration: 2.1s;
  animation-delay: 0.5s;
}
.p8 {
  animation-duration: 2.6s;
  animation-delay: 0.2s;
}
.p9 {
  animation-duration: 2.4s;
  animation-delay: 0.3s;
}

@keyframes bounce-lines {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

#line-v1,
#line-v2,
#node-server,
#panel-rigth,
#reflectores,
#particles {
  animation: bounce-lines 3s ease-in-out infinite alternate;
}
#line-v2 {
  animation-delay: 0.2s;
}

#node-server,
#panel-rigth,
#reflectores,
#particles {
  animation-delay: 0.4s;
}

/* From Uiverse.io by Donewenfu */ 
.loader {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

.loader:before,
.loader:after {
  position: absolute;
  top: 0;
  content: '';
  background: #076fe5;
  -webkit-animation: loading-keys-app-loading 0.8s infinite ease-in-out;
  animation: loading-keys-app-loading 0.8s infinite ease-in-out;
  width: 6.8px;
  height: 16px;
}

.loader:before {
  left: -15px;
}

.loader:after {
  left: 15px;
  -webkit-animation-delay: 0.32s !important;
  animation-delay: 0.32s !important;
}

.loader {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6.8px;
  height: 16px;
  background: #076fe5;
  -webkit-animation: loading-keys-app-loading 0.8s infinite ease-in-out;
  animation: loading-keys-app-loading 0.8s infinite ease-in-out;
  -webkit-animation-delay: 0.16s !important;
  animation-delay: 0.16s !important;
  text-indent: -9999em;
}

/* Center loader containers */
.text-center.py-4 {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 40px !important;
  text-align: center !important;
  position: relative !important;
  height: 88px !important;
  box-sizing: border-box !important;
  padding: 24px 0 !important;
}

@-webkit-keyframes loading-keys-app-loading {

  0%,
  80%,
  100% {
    opacity: .75;
    box-shadow: 0 0 #076fe5;
    height: 16px;
  }

  40% {
    opacity: 1;
    box-shadow: 0 -4px #076fe5;
    height: 20px;
  }
}

/* Industry performance cards hover effect */
.hover-shadow {
  transition: box-shadow 0.2s ease-in-out;
}

.hover-shadow:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}
@keyframes loading-keys-app-loading {

  0%,
  80%,
  100% {
    opacity: .75;
    box-shadow: 0 0 #076fe5;
    height: 16px;
  }

  40% {
    opacity: 1;
    box-shadow: 0 -4px #076fe5;
    height: 20px;
  }
}

/* Dashboard widget action buttons */
.widget .dropdown .btn {
    background: transparent !important;
    border: none !important;
    color: #6c757d !important;
    padding: 0.25rem !important;
    border-radius: 0.25rem !important;
    transition: all 0.15s ease !important;
    min-width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.widget .dropdown .btn:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: #495057 !important;
}

.widget .dropdown .btn:focus {
    box-shadow: none !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.widget .dropdown-menu {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-radius: 0.375rem !important;
    padding: 0.25rem 0 !important;
    min-width: 140px !important;
}

.widget .dropdown-item {
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    color: #495057 !important;
    border-radius: 0.25rem !important;
    margin: 0 0.25rem !important;
    transition: all 0.15s ease !important;
}

.widget .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.widget .dropdown-item i {
    width: 16px !important;
    text-align: center !important;
}

.widget .dropdown-item.text-danger {
    color: #dc3545 !important;
}

.widget .dropdown-item.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1) !important;
    color: #dc3545 !important;
}

/* Dashboard and watchlist 3-dot menu */
.three-dot-dropdown .btn {
    background: transparent !important;
    border: none !important;
    color: #6c757d !important;
    padding: 0.5rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.15s ease !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.3rem !important;
    line-height: 1 !important;
}

.three-dot-dropdown .btn.btn-sm {
    padding: 0.5rem !important;
    font-size: 1.3rem !important;
    line-height: 1 !important;
}

.three-dots-icon {
    font-size: 1.3rem !important;
    line-height: 1 !important;
    font-weight: bold !important;
    color: inherit !important;
}

.three-dot-dropdown .btn:hover {
    background-color: #f8f9fa !important;
    color: #495057 !important;
}

.three-dot-dropdown .dropdown-menu {
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0 !important;
    min-width: 220px !important;
}

.three-dot-dropdown .dropdown-item {
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    color: #495057 !important;
    border-radius: 0.25rem !important;
    margin: 0 0.25rem !important;
    transition: all 0.15s ease !important;
}

.three-dot-dropdown .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.three-dot-dropdown .dropdown-item i {
    width: 16px !important;
    text-align: center !important;
}

.three-dot-dropdown .dropdown-item.text-warning {
    color: #856404 !important;
}

.three-dot-dropdown .dropdown-item.text-warning:hover {
    background-color: rgba(255, 193, 7, 0.1) !important;
    color: #856404 !important;
}

/* Dark mode overrides for 3-dot menu dropdown items */
body.dark-mode .three-dot-dropdown .dropdown-item {
    color: #e9ecef !important;
}

body.dark-mode .three-dot-dropdown .dropdown-item:hover {
    background-color: #495057 !important;
    color: #f8f9fa !important;
}

body.dark-mode .three-dot-dropdown .dropdown-item.text-warning {
    color: #ffc107 !important;
}

body.dark-mode .three-dot-dropdown .dropdown-item.text-warning:hover {
    background-color: rgba(255, 193, 7, 0.15) !important;
    color: #ffc107 !important;
}

.dropdown-divider {
    margin: 0.25rem 0 !important;
}

.dropdown-header {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #6c757d !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.5rem 1rem 0.25rem !important;
    margin-bottom: 0 !important;
}

/* Mobile Responsiveness for Dashboards */
@media (max-width: 1200px) {
    /* Remove container padding on mobile to use full width */
    .container-fluid {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Completely hide grid on mobile/tablet - no background, no borders */
    #widget-grid {
        width: 100% !important;
        min-height: auto !important;
        background: transparent !important;
        background-image: none !important;
        border: none !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0 !important;
        position: static !important;
        overflow-x: hidden !important;
    }
    
    /* Also hide grid for dark mode on mobile */
    body.dark-mode #widget-grid {
        background-image: none !important;
    }
    
    .widget {
        position: static !important;
        width: auto !important;
        margin-bottom: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        flex-basis: 100% !important;
    }
    
    /* Remove card margins on mobile */
    .widget .card {
        margin-bottom: 0 !important;
    }
    
    /* 1x1 widgets can be side by side on mobile */
    .widget[data-size="1x1"] {
        flex-basis: calc(50% - 0.25rem) !important;
    }
    
    /* Hide grid overlay on mobile */
    #drop-overlay {
        display: none !important;
    }
    
    /* Adjust widget sizes for mobile */
    .widget[data-sizex="1"] {
        height: auto !important;
        min-height: 200px !important;
    }
    
    .widget[data-sizex="2"] {
        height: auto !important;
        min-height: 250px !important;
    }
    
    .widget[data-sizex="3"] {
        height: auto !important;
        min-height: 300px !important;
    }
    
    .widget[data-sizex="4"] {
        height: auto !important;
        min-height: 350px !important;
    }
    
    /* Make cards more touch-friendly */
    .card-header {
        padding: 0.5rem 0.75rem !important;
        min-height: 44px !important; /* iOS touch target minimum */
    }
    
    .card-header h6 {
        font-size: 0.85rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
    }
    
    /* Adjust button sizes for touch */
    .btn-group .btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
        min-height: 44px !important;
    }
    
    /* Make dropdown items more touch-friendly */
    .dropdown-item {
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Make dashboard header 3-dot menu bigger on mobile */
    .three-dot-dropdown .btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        font-size: 1.4rem !important;
    }
    
    .three-dots-icon {
        font-size: 1.4rem !important;
        width: 1.4rem !important;
        height: 1.4rem !important;
    }
    
    /* Adjust chart sizes for mobile */
    .chart-container {
        height: 200px !important;
    }
    
    /* Make text more readable on mobile */
    .stock-item, .market-index-item, .news-item {
        font-size: 0.85rem !important;
        padding: 0.5rem 0 !important;
    }
    
    .metric-row {
        font-size: 0.85rem !important;
    }
    
    /* Hide grid overlay on mobile */
    #drop-overlay {
        display: none !important;
    }
    
    /* Improve dropdown buttons on mobile */
    .widget .dropdown .btn {
        min-width: 32px !important;
        height: 32px !important;
        padding: 0.375rem !important;
    }
    
    .widget .dropdown-menu {
        min-width: 160px !important;
    }
    
    .widget .dropdown-item {
        padding: 0.625rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Make stock page nav-tabs more mobile-friendly (only for #stockTabs, not analysis tabs) */
    #stockTabs .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
        white-space: nowrap !important;
    }
    
    /* Allow horizontal scrolling for stockTabs on small screens */
    #stockTabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge */
    }
    
    #stockTabs::-webkit-scrollbar {
        display: none !important; /* Chrome/Safari */
    }
}

@media (max-width: 576px) {
    /* Extra small screens - further optimizations */
    .card-header {
        padding: 0.4rem 0.6rem !important;
    }
    
    .card-body {
        padding: 0.6rem !important;
    }
    
    .btn-group .btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
    }
    
    .widget {
        margin-bottom: 0 !important;
    }
    
    /* Stack dashboard action buttons vertically on very small screens */
    .text-center.mb-4 .btn {
        display: block !important;
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }
    
    .text-center.mb-4 .btn-group {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .text-center.mb-4 .btn-group .btn {
        border-radius: 0 !important;
        margin-bottom: 0 !important;
    }
    
    .text-center.mb-4 .btn-group .btn:first-child {
        border-top-left-radius: 0.375rem !important;
        border-top-right-radius: 0.375rem !important;
    }
    
    .text-center.mb-4 .btn-group .btn:last-child {
        border-bottom-left-radius: 0.375rem !important;
        border-bottom-right-radius: 0.375rem !important;
        border-bottom: 1px solid #dee2e6 !important;
    }
    
    /* Make dashboard header 3-dot menu bigger on small screens */
    .three-dot-dropdown .btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        font-size: 1.4rem !important;
    }
    
    .three-dots-icon {
        font-size: 1.4rem !important;
        width: 1.4rem !important;
        height: 1.4rem !important;
    }
    
    /* Make stock page nav-tabs even more compact on very small screens (only for #stockTabs) */
    #stockTabs .nav-link {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
        min-width: auto !important;
    }
    
    /* Style PWA install button on mobile */
    #install-button {
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
        white-space: nowrap !important;
    }
}

.blur-text {
    filter: blur(4px);
    user-select: none;
}