.stock-history-popup {
    position: fixed;
    z-index: 999999;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(99, 102, 241, 0.1);
    min-width: 680px;
    max-width: 780px;
    max-height: 480px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: shPopupIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

@keyframes shPopupIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.sh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8faff 0%, #eef2ff 100%);
}

.sh-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sh-header-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.sh-header-info {
    display: flex;
    flex-direction: column;
}

.sh-header-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

.sh-header-subtitle {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.sh-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sh-tab-btn {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.sh-tab-btn.active {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.sh-tab-btn:hover:not(.active) {
    background: #f1f5f9;
    color: #334155;
}

.sh-filter-select {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    cursor: pointer;
    outline: none;
    min-width: 65px;
}

.sh-toggle-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.sh-toggle-btn.active {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.sh-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #c7d2fe transparent;
}

.sh-body::-webkit-scrollbar {
    width: 5px;
}

.sh-body::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 4px;
}

.sh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.sh-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
    padding: 7px 8px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sh-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.sh-table tbody tr:hover {
    background: #f8fafc;
}

.sh-table td {
    padding: 6px 8px;
    color: #334155;
    white-space: nowrap;
}

.sh-table td.sh-ref {
    color: #6366f1;
    font-weight: 600;
    cursor: pointer;
}

.sh-table td.sh-ref:hover {
    text-decoration: underline;
}

.sh-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 11px;
    color: #64748b;
}

.sh-footer-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eef2ff;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    color: #4338ca;
}

.sh-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #64748b;
    gap: 12px;
}

.sh-loading i {
    font-size: 24px;
    color: #6366f1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sh-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #94a3b8;
    gap: 8px;
}

.sh-empty i {
    font-size: 28px;
    color: #cbd5e1;
}
